]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: acquire inode snaplock in open 53184/head
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 18 Jul 2023 00:52:13 +0000 (20:52 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 28 Aug 2023 13:32:50 +0000 (09:32 -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>
(cherry picked from commit c04ab6f0868a7385e695c85486cf3e7bbdfa9ab5)

src/mds/Server.cc

index 2236129c564186b8df2104bade46bff9b8b5a778..8d351730c34bd5276d7779a7f838ef72209a06c1 100644 (file)
@@ -4377,6 +4377,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) {
@@ -4549,11 +4550,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;
   }