l30013671 / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
e293be
centosplus patch [bug#15953]
e293be
e293be
https://tracker.ceph.com/issues/37713
e293be
e293be
Provided by:  Zheng Yan <ukernel@gmail.com>
e293be
e293be
--- a/fs/ceph/file.c	2019-03-25 13:43:20.001424423 -0700
e293be
+++ b/fs/ceph/file.c	2019-03-25 13:45:44.911586556 -0700
e293be
@@ -1487,6 +1487,7 @@ retry_snap:
e293be
 	    (ci->i_ceph_flags & CEPH_I_ERROR_WRITE)) {
e293be
 		struct ceph_snap_context *snapc;
e293be
 		struct iov_iter i;
e293be
+		loff_t orig_ki_pos;
e293be
 		mutex_unlock(&inode->i_mutex);
e293be
 
e293be
 		spin_lock(&ci->i_ceph_lock);
e293be
@@ -1504,11 +1505,15 @@ retry_snap:
e293be
 
e293be
 		iov_iter_init(&i, iov, nr_segs, count, 0);
e293be
 
e293be
+		orig_ki_pos = iocb->ki_pos;
e293be
+		iocb->ki_pos = pos;
e293be
 		if (file->f_flags & O_DIRECT)
e293be
 			written = ceph_direct_read_write(iocb, &i, snapc,
e293be
 							 &prealloc_cf);
e293be
 		else
e293be
 			written = ceph_sync_write(iocb, &i, snapc);
e293be
+		if (iocb->ki_pos == pos)
e293be
+			iocb->ki_pos = orig_ki_pos;
e293be
 
e293be
 		ceph_put_snap_context(snapc);
e293be
 	} else {