]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds: rdlock_path_xlock_dentry supports returning auth target inode
authorZhansong Gao <zhsgao@hotmail.com>
Tue, 10 Jan 2023 13:40:12 +0000 (21:40 +0800)
committerZhansong Gao <zhsgao@hotmail.com>
Fri, 31 Mar 2023 10:29:05 +0000 (18:29 +0800)
commitcf5fdcd6e2d22f35b670d3c13ae8b7c9b9d2616d
tree69f6dad4f6389699b79987a7825d39d3dc02c695
parentc76e8e5538134f2411e1d877ded16536fe0f18c8
mds: rdlock_path_xlock_dentry supports returning auth target inode

`Server::handle_client_openc` will call `Server::handle_client_open`
if the target inode exists. `Server::handle_client_open requires`
the target inode to be auth if client sets `O_WRONLY` or `O_TRUNC`,
but `Server::rdlock_path_xlock_dentry` can not ensure that. The assertion
that the target inode is auth in `Server::handle_client_open` may fail
and it will crash mds. So add a parameter to to support returning
auth target inode if it exists and forward the request if necessary.
The tail dentry may not be auth anymore when an auth target inode
is provided as required by the caller, because we can't require
both of them to be auth in one mds.
This bug will only be triggered in kernel client, because ceph-fuse
client will try to lookup the target before sending a create request
to mds and it can send an open request instead if the target exists.
But kernel client will send the create request to mds without lookup
first because `atomic open` is supported to improve performance.

Fixes: https://tracker.ceph.com/issues/58411
Signed-off-by: Zhansong Gao <zhsgao@hotmail.com>
src/mds/MDCache.cc
src/mds/MDCache.h
src/mds/Server.cc
src/mds/Server.h