]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: allow unlink operation under lost+found directory
authorVenky Shankar <vshankar@redhat.com>
Wed, 19 Apr 2023 07:09:04 +0000 (03:09 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 23 May 2023 04:35:34 +0000 (10:05 +0530)
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 <vshankar@redhat.com>
(cherry picked from commit 241b9396dbc6d506cef297bdb89ab07fe3a7ce02)

src/mds/CInode.h
src/mds/Server.cc

index 29d05cc7c3f33e035fcece3f579ae9a85aa6c2fc..6ba4a55940c82dd85f8f61eab555a795bbc5dfa1 100644 (file)
@@ -656,6 +656,7 @@ class CInode : public MDSCacheObject, public InodeStoreBase, public Counter<CIno
   bool is_mdsdir() const { return MDS_INO_IS_MDSDIR(ino()); }
   bool is_base() const { return MDS_INO_IS_BASE(ino()); }
   bool is_system() const { return ino() < MDS_INO_SYSTEM_BASE; }
+  bool is_lost_and_found() const { return ino() == CEPH_INO_LOST_AND_FOUND; }
   bool is_normal() const { return !(is_base() || is_system() || is_stray()); }
   bool is_file() const    { return get_inode()->is_file(); }
   bool is_symlink() const { return get_inode()->is_symlink(); }
index b8627e8e071c52a0b510bfc7af627b348c0507ad..07e46556a8ef7341733acc8eb6a30aaeb4c2063f 100644 (file)
@@ -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;
     }