1
0
Fork 0
alistair23-linux/fs/ceph
Luis Henriques 8074607871 ceph: don't return -ESTALE if there's still an open file
[ Upstream commit 878dabb641 ]

Similarly to commit 03f219041f ("ceph: check i_nlink while converting
a file handle to dentry"), this fixes another corner case with
name_to_handle_at/open_by_handle_at.  The issue has been detected by
xfstest generic/467, when doing:

 - name_to_handle_at("/cephfs/myfile")
 - open("/cephfs/myfile")
 - unlink("/cephfs/myfile")
 - sync; sync;
 - drop caches
 - open_by_handle_at()

The call to open_by_handle_at should not fail because the file hasn't been
deleted yet (only unlinked) and we do have a valid handle to it.  -ESTALE
shall be returned only if i_nlink is 0 *and* i_count is 1.

This patch also makes sure we have LINK caps before checking i_nlink.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Acked-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-24 17:50:37 +02:00
..
Kconfig ceph: add selinux support 2019-07-08 14:01:42 +02:00
Makefile ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
acl.c ceph: rename struct ceph_acls_info to ceph_acl_sec_ctx 2019-07-08 14:01:42 +02:00
addr.c ceph: use release_pages() directly 2019-09-16 12:06:25 +02:00
cache.c ceph: include ceph_debug.h in cache.c 2019-09-16 12:06:25 +02:00
cache.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 188 2019-05-30 11:29:21 -07:00
caps.c ceph: flush release queue when handling caps for unknown inode 2020-06-03 08:21:25 +02:00
ceph_frag.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
debugfs.c ceph: don't return a value from void function 2019-09-16 12:06:25 +02:00
dir.c ceph: fix compat_ioctl for ceph_dir_operations 2019-12-17 19:55:31 +01:00
export.c ceph: don't return -ESTALE if there's still an open file 2020-06-24 17:50:37 +02:00
file.c ceph: check POOL_FLAG_FULL/NEARFULL in addition to OSDMAP_FULL/NEARFULL 2020-04-01 11:01:58 +02:00
inode.c ceph: add missing check in d_revalidate snapdir handling 2019-10-29 22:29:55 +01:00
io.c ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
io.h ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
ioctl.c libceph, ceph: move ceph_calc_file_object_mapping() to striper.c 2018-04-02 10:12:43 +02:00
ioctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
locks.c ceph: return -EIO if read/write against filp that lost file locks 2019-09-16 12:06:24 +02:00
mds_client.c ceph: fix endianness bug when handling MDS session feature bits 2020-05-14 07:58:27 +02:00
mds_client.h ceph: eliminate session->s_trim_caps 2019-09-16 12:06:24 +02:00
mdsmap.c ceph: have MDS map decoding use entity_addr_t decoder 2019-07-08 14:01:43 +02:00
quota.c ceph: demote quotarealm lookup warning to a debug message 2020-05-14 07:58:27 +02:00
snap.c ceph: fix memory leak in ceph_cleanup_snapid_map() 2020-04-01 11:01:59 +02:00
strings.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
super.c ceph: canonicalize server path in place 2020-04-13 10:48:11 +02:00
super.h ceph: canonicalize server path in place 2020-04-13 10:48:11 +02:00
xattr.c ceph: allow arbitrary security.* xattrs 2019-09-16 12:06:25 +02:00