Patch "ceph: don't clobber i_snap_caps on non-I_NEW inode" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ceph: don't clobber i_snap_caps on non-I_NEW inode

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ceph-don-t-clobber-i_snap_caps-on-non-i_new-inode.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 01192bc07f1b2408f5c8abb51e3d76db7ba4b3e8
Author: Jeff Layton <jlayton@xxxxxxxxxx>
Date:   Mon Mar 1 07:38:01 2021 -0500

    ceph: don't clobber i_snap_caps on non-I_NEW inode
    
    [ Upstream commit d3c51ae1b8cce5bdaf91a1ce32b33cf5626075dc ]
    
    We want the snapdir to mirror the non-snapped directory's attributes for
    most things, but i_snap_caps represents the caps granted on the snapshot
    directory by the MDS itself. A misbehaving MDS could issue different
    caps for the snapdir and we lose them here.
    
    Only reset i_snap_caps when the inode is I_NEW. Also, move the setting
    of i_op and i_fop inside the if block since they should never change
    anyway.
    
    Reported-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
    Signed-off-by: Ilya Dryomov <idryomov@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 6bd2a6ced22a..790433cb849e 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -87,14 +87,15 @@ struct inode *ceph_get_snapdir(struct inode *parent)
 	inode->i_mtime = parent->i_mtime;
 	inode->i_ctime = parent->i_ctime;
 	inode->i_atime = parent->i_atime;
-	inode->i_op = &ceph_snapdir_iops;
-	inode->i_fop = &ceph_snapdir_fops;
-	ci->i_snap_caps = CEPH_CAP_PIN; /* so we can open */
 	ci->i_rbytes = 0;
 	ci->i_btime = ceph_inode(parent)->i_btime;
 
-	if (inode->i_state & I_NEW)
+	if (inode->i_state & I_NEW) {
+		inode->i_op = &ceph_snapdir_iops;
+		inode->i_fop = &ceph_snapdir_fops;
+		ci->i_snap_caps = CEPH_CAP_PIN; /* so we can open */
 		unlock_new_inode(inode);
+	}
 
 	return inode;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux