]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Don't writeback when inside a readdir callback 37774/head
authorDaniel Gryniewicz <dang@redhat.com>
Fri, 23 Oct 2020 16:37:20 +0000 (12:37 -0400)
committerDaniel Gryniewicz <dang@redhat.com>
Fri, 23 Oct 2020 16:43:03 +0000 (12:43 -0400)
The code updates some attributes that may have changed between versions
when doing a lookup.  However, a lookup can be done from within a
readdir callback, which causes a deadlock during the writeback.  Extend
the flag indicating we're in a callback all the way down, so we can
conditionally avoid the write.

Fixes RHBZ#1845501

Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
src/rgw/rgw_file.cc
src/rgw/rgw_file.h

index 652e39b3492bba125c862d23bfc5e879c7449295..e5390b0da523eee65db45f3e924e129648ee5e42 100644 (file)
@@ -187,7 +187,8 @@ namespace rgw {
            auto ux_attrs = req.get_attr(RGW_ATTR_UNIX1);
             rgw_fh->set_etag(*(req.get_attr(RGW_ATTR_ETAG)));
             rgw_fh->set_acls(*(req.get_attr(RGW_ATTR_ACL)));
-           if (ux_key && ux_attrs) {
+           if (!(flags & RGWFileHandle::FLAG_IN_CB) &&
+               ux_key && ux_attrs) {
               DecodeAttrsResult dar = rgw_fh->decode_attrs(ux_key, ux_attrs);
               if (get<0>(dar) || get<1>(dar)) {
                 update_fh(rgw_fh);
@@ -223,7 +224,8 @@ namespace rgw {
            auto ux_attrs = req.get_attr(RGW_ATTR_UNIX1);
             rgw_fh->set_etag(*(req.get_attr(RGW_ATTR_ETAG)));
             rgw_fh->set_acls(*(req.get_attr(RGW_ATTR_ACL)));
-           if (ux_key && ux_attrs) {
+           if (!(flags & RGWFileHandle::FLAG_IN_CB) &&
+               ux_key && ux_attrs) {
               DecodeAttrsResult dar = rgw_fh->decode_attrs(ux_key, ux_attrs);
               if (get<0>(dar) || get<1>(dar)) {
                 update_fh(rgw_fh);
@@ -2033,7 +2035,7 @@ int rgw_lookup(struct rgw_fs *rgw_fs,
 
       uint32_t sl_flags = (flags & RGW_LOOKUP_FLAG_RCB)
        ? RGWFileHandle::FLAG_NONE
-       : RGWFileHandle::FLAG_EXACT_MATCH;
+       : RGWFileHandle::FLAG_EXACT_MATCH | RGWFileHandle::FLAG_IN_CB;
 
       bool fast_attrs= fs->get_context()->_conf->rgw_nfs_s3_fast_attrs;
 
index c9ca62bc3448919c8b93fc07f518e0456bb05a88..9ec8a2955178c70e4b662e6454791f56bff7d762 100644 (file)
@@ -268,6 +268,7 @@ namespace rgw {
     static constexpr uint32_t FLAG_STATELESS_OPEN = 0x0400;
     static constexpr uint32_t FLAG_EXACT_MATCH = 0x0800;
     static constexpr uint32_t FLAG_MOUNT = 0x1000;
+    static constexpr uint32_t FLAG_IN_CB = 0x2000;
 
 #define CREATE_FLAGS(x) \
     ((x) & ~(RGWFileHandle::FLAG_CREATE|RGWFileHandle::FLAG_LOCK))