]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: fix fs_inst progression 13832/head
authorMatt Benjamin <mbenjamin@redhat.com>
Tue, 7 Mar 2017 14:48:57 +0000 (09:48 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Tue, 7 Mar 2017 16:43:39 +0000 (11:43 -0500)
Reported by Gui Hecheng<guimark@126.com>.  This change is a
variation on proposed fix by Dan Gryniewicz<dang@redhat.com>
to take root_fh.state.dev as fs_inst for new handles.

Fixes: http://tracker.ceph.com/issues/19214
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_file.cc
src/rgw/rgw_file.h

index 2df931dd185fd0157eb0c43c731f2273a28cc1e2..f1d1ef1649d4985bbf56289b31e2ec333695f69b 100644 (file)
@@ -37,7 +37,7 @@ namespace rgw {
 
   const string RGWFileHandle::root_name = "/";
 
-  atomic<uint32_t> RGWLibFS::fs_inst;
+  atomic<uint32_t> RGWLibFS::fs_inst_counter;
 
   uint32_t RGWLibFS::write_completion_interval_s = 10;
 
index 68ae24f0cce251fdef8216659e09095fe37fde8c..d5d1626f3d10d8a55a8876d9a80a774295f73cf8 100644 (file)
@@ -706,7 +706,8 @@ namespace rgw {
     RGWUserInfo user;
     RGWAccessKey key; // XXXX acc_key
 
-    static atomic<uint32_t> fs_inst;
+    static atomic<uint32_t> fs_inst_counter;
+
     static uint32_t write_completion_interval_s;
     std::string fsid;
 
@@ -757,6 +758,10 @@ namespace rgw {
       }
     } state;
 
+    uint32_t new_inst() {
+      return ++fs_inst_counter;
+    }
+
     friend class RGWFileHandle;
     friend class RGWLibProcess;
 
@@ -767,7 +772,7 @@ namespace rgw {
 
     RGWLibFS(CephContext* _cct, const char *_uid, const char *_user_id,
            const char* _key)
-      : cct(_cct), root_fh(this, get_inst()), invalidate_cb(nullptr),
+      : cct(_cct), root_fh(this, new_inst()), invalidate_cb(nullptr),
        invalidate_arg(nullptr), shutdown(false), refcnt(1),
        fh_cache(cct->_conf->rgw_nfs_fhcache_partitions,
                 cct->_conf->rgw_nfs_fhcache_size),
@@ -775,12 +780,9 @@ namespace rgw {
               cct->_conf->rgw_nfs_lru_lane_hiwat),
        uid(_uid), key(_user_id, _key) {
 
-      /* fixup fs_inst */
-      root_fh.state.dev = ++fs_inst;
-
       /* no bucket may be named rgw_fs_inst-(.*) */
       fsid = RGWFileHandle::root_name + "rgw_fs_inst-" +
-       std::to_string(fs_inst);
+       std::to_string(get_inst());
 
       root_fh.init_rootfs(fsid /* bucket */, RGWFileHandle::root_name);
 
@@ -1088,7 +1090,7 @@ namespace rgw {
 
     struct rgw_fs* get_fs() { return &fs; }
 
-    uint32_t get_inst() { return fs_inst; }
+    uint32_t get_inst() { return root_fh.state.dev; }
 
     RGWUserInfo* get_user() { return &user; }