diff options
author | Yan, Zheng <zyan@redhat.com> | 2019-02-11 15:18:52 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-23 08:44:15 +0100 |
commit | 1ff6adf145499685d4552a24e840f01e366a744a (patch) | |
tree | 954037f47f4733a106e2962de54e623dd8b77272 /fs/ceph | |
parent | af13f43f01a3e4a11686f5fa4de42ecec8ed71b1 (diff) | |
download | linux-stable-1ff6adf145499685d4552a24e840f01e366a744a.tar.gz linux-stable-1ff6adf145499685d4552a24e840f01e366a744a.tar.bz2 linux-stable-1ff6adf145499685d4552a24e840f01e366a744a.zip |
ceph: avoid repeatedly adding inode to mdsc->snap_flush_list
commit 04242ff3ac0abbaa4362f97781dac268e6c3541a upstream.
Otherwise, mdsc->snap_flush_list may get corrupted.
Cc: stable@vger.kernel.org
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/snap.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 4aa7122a8d38..a485d0cdc559 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -611,7 +611,8 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci, capsnap->size); spin_lock(&mdsc->snap_flush_lock); - list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list); + if (list_empty(&ci->i_snap_flush_item)) + list_add_tail(&ci->i_snap_flush_item, &mdsc->snap_flush_list); spin_unlock(&mdsc->snap_flush_lock); return 1; /* caller may want to ceph_flush_snaps */ } |