Commit 203627bb authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: fix blksize calculation

Don't use inode->i_blkbits which might be stale, instead calculate the blksize
information from the freshly obtained attributes.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent 45c72cd7
...@@ -775,6 +775,8 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, ...@@ -775,6 +775,8 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr, static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr,
struct kstat *stat) struct kstat *stat)
{ {
unsigned int blkbits;
stat->dev = inode->i_sb->s_dev; stat->dev = inode->i_sb->s_dev;
stat->ino = attr->ino; stat->ino = attr->ino;
stat->mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777); stat->mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
...@@ -790,7 +792,13 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr, ...@@ -790,7 +792,13 @@ static void fuse_fillattr(struct inode *inode, struct fuse_attr *attr,
stat->ctime.tv_nsec = attr->ctimensec; stat->ctime.tv_nsec = attr->ctimensec;
stat->size = attr->size; stat->size = attr->size;
stat->blocks = attr->blocks; stat->blocks = attr->blocks;
stat->blksize = (1 << inode->i_blkbits);
if (attr->blksize != 0)
blkbits = ilog2(attr->blksize);
else
blkbits = inode->i_sb->s_blocksize_bits;
stat->blksize = 1 << blkbits;
} }
static int fuse_do_getattr(struct inode *inode, struct kstat *stat, static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment