]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: check i_nlink while converting a file handle to dentry
authorLuis Henriques <lhenriques@suse.com>
Wed, 17 May 2017 11:21:07 +0000 (12:21 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 14 Jun 2017 17:32:43 +0000 (19:32 +0200)
commitad0c1f1cd33475b3cf975c6628cba4b28db197f4
tree2c831e0e6149df0f676a419e8c90d1d5cd68dd41
parentd3add402c89192df5bac6bd430c3865ad409843b
ceph: check i_nlink while converting a file handle to dentry

Converting a file handle to a dentry can be done call after the inode
unlink.  This means that __fh_to_dentry() requires an extra check to
verify the number of links is not 0.

The issue can be easily reproduced using xfstest generic/426, which does
something like:

    name_to_handle_at(&fh)
    echo 3 > /proc/sys/vm/drop_caches
    unlink()
    open_by_handle_at(&fh)

The call to open_by_handle_at() should fail, as the file doesn't exist
anymore.

Link: http://tracker.ceph.com/issues/19958
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/export.c