summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2019-02-11 15:18:52 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-27 10:06:58 +0100
commit79e3959b68cb08f086c6a65f3b3a36348e0cc5fd (patch)
treec8bf46ece890fc7cfe470ae2e517cde8d5f409fe /fs
parenta1f11de42378ef4c9fab701f6f2ff21b266a5c87 (diff)
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')
-rw-r--r--fs/ceph/snap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 9ff5219d849e..411e9df0d40e 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -609,7 +609,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 */
}