summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-05-10 19:49:38 +0400
committerMiklos Szeredi <mszeredi@suse.cz>2012-05-14 17:12:56 +0200
commit203627bbc90377c509e32450c67c5d957ba2d989 (patch)
tree69fbf5d277641ae3cb496e9afa64550f6b3c3a3f
parent45c72cd73c788dd18c8113d4a404d6b4a01decf1 (diff)
downloadop-kernel-dev-203627bbc90377c509e32450c67c5d957ba2d989.zip
op-kernel-dev-203627bbc90377c509e32450c67c5d957ba2d989.tar.gz
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: Miklos Szeredi <mszeredi@suse.cz>
-rw-r--r--fs/fuse/dir.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index bc43832..334e0b1 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -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,
struct kstat *stat)
{
+ unsigned int blkbits;
+
stat->dev = inode->i_sb->s_dev;
stat->ino = attr->ino;
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,
stat->ctime.tv_nsec = attr->ctimensec;
stat->size = attr->size;
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,
OpenPOWER on IntegriCloud