From: Daniel Gryniewicz Date: Fri, 23 Oct 2020 16:37:20 +0000 (-0400) Subject: Don't writeback when inside a readdir callback X-Git-Tag: v16.1.0~749^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=96ed1665701cb1d43c2ddbb54329f8beb93b53cf;p=ceph.git Don't writeback when inside a readdir callback 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 --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 652e39b3492b..e5390b0da523 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -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; diff --git a/src/rgw/rgw_file.h b/src/rgw/rgw_file.h index c9ca62bc3448..9ec8a2955178 100644 --- a/src/rgw/rgw_file.h +++ b/src/rgw/rgw_file.h @@ -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))