[PATCH] ceph: always set the initial i_blkbits to CEPH_FSCRYPT_BLOCK_SHIFT

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

 



From: Xiubo Li <xiubli@xxxxxxxxxx>

The fscrypt code will use i_blkbits to setup the 'ci_data_unit_bits'
when allocating the new inode, but ceph will initiate i_blkbits
ater when filling the inode, which is too late. Since the
'ci_data_unit_bits' will only be used by the fscrypt framework so
initiating i_blkbits with CEPH_FSCRYPT_BLOCK_SHIFT is safe.

Fixes: commit 5b1188847180 ("fscrypt: support crypto data unit size
       less than filesystem block size")
URL: https://tracker.ceph.com/issues/64035
Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
---
 fs/ceph/inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 62af452cdba4..d96d97b31f68 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -79,6 +79,8 @@ struct inode *ceph_new_inode(struct inode *dir, struct dentry *dentry,
 	if (!inode)
 		return ERR_PTR(-ENOMEM);
 
+	inode->i_blkbits = CEPH_FSCRYPT_BLOCK_SHIFT;
+
 	if (!S_ISLNK(*mode)) {
 		err = ceph_pre_init_acls(dir, mode, as_ctx);
 		if (err < 0)
-- 
2.39.1





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux