]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: acquire inode snaplock in open 53185/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:33:30 +0000 (09:33 -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 82f2a2e5e6587d2a79085a53586d1e1a3bf8d93b..b43c0c907fdb38b6da346d56e313290aa8bc12a9 100644 (file)
@@ -4392,6 +4392,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) {
@@ -4564,11 +4565,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;
   }