afs: Only update d_fsdata if different in afs_d_revalidate()
authorDavid Howells <dhowells@redhat.com>
Tue, 30 Jul 2019 13:38:51 +0000 (14:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 08:21:55 +0000 (10:21 +0200)
commit9c55dc85d890b6705f3a7f801ca59c8a7059c4f4
tree8204eacd217e96865c1dc8c0ac47530f000fc086
parent24e093b9690588c41522245dfc777f7f9b210d52
afs: Only update d_fsdata if different in afs_d_revalidate()

[ Upstream commit 5dc84855b0fc7e1db182b55c5564fd539d6eff92 ]

In the in-kernel afs filesystem, d_fsdata is set with the data version of
the parent directory.  afs_d_revalidate() will update this to the current
directory version, but it shouldn't do this if it the value it read from
d_fsdata is the same as no lock is held and cmpxchg() is not used.

Fix the code to only change the value if it is different from the current
directory version.

Fixes: 260a980317da ("[AFS]: Add "directory write" support.")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/afs/dir.c