]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librgw: make rgw file handle versioned
authorXuehan Xu <xuxuehan@qianxin.com>
Sat, 2 Jan 2021 14:50:23 +0000 (22:50 +0800)
committerCory Snyder <csnyder@iland.com>
Thu, 17 Mar 2022 13:34:34 +0000 (09:34 -0400)
commitf7e64f7270d0e26465a317b5f88b0c5a460254fb
treef5b3814d081831b346242d2512bd0075a238aad1
parent065c9d29f7426c283cf80fed433ed59efc43fe5e
librgw: make rgw file handle versioned

The reason that we need this is that there could be the following scenario:

1. rgw_setattr sets the file attr;
2. rgw_write writes some new data, and encodes its attr to store into rados;
3. before the actual persistence of the file's attr bl, rgw_lookup loads the file's
   previous attr and modifies the current file handle's metadata;
4. rgw_write's result persisted to rados;
5. rgw_setattr set the current file handle's metadata which is actually an old one to rados

In this case, the attr in rados would be out of date which means loss of data

Fixes: https://tracker.ceph.com/issues/50194
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
(cherry picked from commit 49a35d72e0982c03781d4845c800332bded1c658)
src/rgw/rgw_file.cc
src/rgw/rgw_file.h