From: Venky Shankar Date: Wed, 19 Apr 2023 07:09:04 +0000 (-0400) Subject: mds: allow unlink operation under lost+found directory X-Git-Tag: v16.2.14~54^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f95a1ac167f0184fa77ad1e0a16f1ff1050b8597;p=ceph.git mds: allow unlink operation under lost+found directory Deleting entries in lost+found directory is suggested once users are done with those entries (possibly, by copying them), however, unlinking is disallowed by the gating the operation via -EROFS. Remove this constraint. Fixes: http://tracker.ceph.com/issues/59569 Signed-off-by: Venky Shankar (cherry picked from commit 241b9396dbc6d506cef297bdb89ab07fe3a7ce02) --- diff --git a/src/mds/CInode.h b/src/mds/CInode.h index 29d05cc7c3f3..6ba4a55940c8 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -656,6 +656,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counteris_file(); } bool is_symlink() const { return get_inode()->is_symlink(); } diff --git a/src/mds/Server.cc b/src/mds/Server.cc index b8627e8e071c..07e46556a8ef 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3645,7 +3645,9 @@ CDentry* Server::rdlock_path_xlock_dentry(MDRequestRef& mdr, CInode *diri = dir->get_inode(); if (!mdr->reqid.name.is_mds()) { - if (diri->is_system() && !diri->is_root()) { + if (diri->is_system() && !diri->is_root() && + (!diri->is_lost_and_found() || + mdr->client_request->get_op() != CEPH_MDS_OP_UNLINK)) { respond_to_request(mdr, -CEPHFS_EROFS); return nullptr; }