]> www.infradead.org Git - linux.git/commit
gfs2: Prevent inode creation race (2)
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 5 Mar 2025 13:14:37 +0000 (14:14 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 10 Mar 2025 17:15:38 +0000 (18:15 +0100)
commit9136cad723ec3e5ab5ca85a839f151abf1c9a106
tree803bfecde5e269993bf091c97109d485565d2830
parent6cb3b1c2df87a8048ee1d54ec16d2e757af86c7f
gfs2: Prevent inode creation race (2)

In gfs2_try_evict(), we try grabbing the inode to evict, we try to evict
it, and then we try grabbing it again to see if it still exists.  There
is no guarantee that we will end up with the same inode both times; the
inode validity check that commit ffd1cf0443a2 ("gfs2: Prevent inode
creation race") added to the first grab is actually needed both times.

(To avoid code duplication, add a grab_existing_inode() helper.)

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c