]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: acquire inode snaplock in open 52520/head
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 18 Jul 2023 00:52:13 +0000 (20:52 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 18 Jul 2023 12:44:07 +0000 (08:44 -0400)
It doesn't make sense that

   open("file", O_CREAT|...)

will acquire a readlock on the file's snaplock when the file already
exists, but:

   open("file", ...)

will not.

Fixes: https://tracker.ceph.com/issues/62058
Fixes: c1d7f93d7bd06d773b8035359548c0c9216398e3
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/Server.cc

index 94397d9f067e8c07eb0a3a30986940cb6ce16343..d383a3fb307ddbd2fb9f8a08e3cab99fbd4a616d 100644 (file)
@@ -4438,6 +4438,7 @@ void Server::handle_client_open(MDRequestRef& mdr)
   }
 
   MutationImpl::LockOpVec lov;
+  lov.add_rdlock(&cur->snaplock);
 
   unsigned mask = req->head.args.open.mask;
   if (mask) {
@@ -4609,11 +4610,6 @@ void Server::handle_client_openc(MDRequestRef& mdr)
     // it existed.
     ceph_assert(mdr.get()->is_rdlocked(&dn->lock));
 
-    MutationImpl::LockOpVec lov;
-    lov.add_rdlock(&dnl->get_inode()->snaplock);
-    if (!mds->locker->acquire_locks(mdr, lov))
-      return;
-
     handle_client_open(mdr);
     return;
   }