Re: [PATCH] ceph: fail the open_by_handle_at() if the dentry is being unlinked
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: xiubli@xxxxxxxxxx
- Subject: Re: [PATCH] ceph: fail the open_by_handle_at() if the dentry is being unlinked
- From: Sebastian Hasler <sebastian.hasler@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 6 Sep 2023 18:58:20 +0200
- Cc: ceph-devel@xxxxxxxxxxxxxxx
- In-reply-to: <20220804080624.14768-1-xiubli@redhat.com>
- References: <20220804080624.14768-1-xiubli@redhat.com>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0
While reviewing the implementation of __fh_to_dentry (in the CephFS
client), I noticed a possible race condition.
Linux has a syscall linkat(2) which allows, given an open file
descriptor, to create a link for the file. So an inode that is unlinked
can become linked.
Now the problem: The line ((inode->i_nlink == 0) &&
!__ceph_is_file_opened(ci)) performs two checks. If, in between those
checks, the file goes from the unlinked and open state to the linked and
closed state, then we return -ESTALE even though the inode is linked. I
don't think this is the intended behavior. I guess this (going from
unlinked and open to linked and closed) can happen when a concurrent
process calls linkat() and then close().
[Index of Archives]
[CEPH Users]
[Ceph Large]
[Ceph Dev]
[Information on CEPH]
[Linux BTRFS]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Yosemite News]
[Linux Kernel]
[Linux SCSI]