On Tue, 19 Aug 2025 16:43:05 Miklos wrote: > On Mon, 18 Aug 2025 at 10:32, Chunsheng Luo <luochunsheng@xxxxxxxx> wrote: > > > > On Fri, 15 Aug 2025 11:25:38 Joanne Koong wrote: > > >diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h > > >index ec248d13c8bf..1647eb7ca6fa 100644 > > >--- a/fs/fuse/fuse_i.h > > >+++ b/fs/fuse/fuse_i.h > > >@@ -210,6 +210,12 @@ struct fuse_inode { > > > /** Reference to backing file in passthrough mode */ > > > struct fuse_backing *fb; > > > #endif > > >+ > > >+ /* > > >+ * The underlying inode->i_blkbits value will not be modified, > > >+ * so preserve the blocksize specified by the server. > > >+ */ > > >+ u8 cached_i_blkbits; > > > }; > > > > Does the `cached_i_blkbits` member also need to be initialized in the > > `fuse_alloc_inode` function like `orig_ino`? > > > > And I am also confused, why does `orig_ino` need to be initialized in > > `fuse_alloc_inode`, but the `orig_i_mode` member does not need it? > > Strictly speaking neither one needs initialization, since these > shouldn't be accessed until the in-core inode is set up in lookup or > create. > > But having random values in there is not nice, so I prefer having > everything initialized in fuse_alloc_inode(). See patch below > (whitespace damage(TM) by gmail). > > Thanks, > Miklos > Understood. Thanks for the explanation. The below patch looks good to me. Thanks. Chunsheng Luo > diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c > index 19fc58cb84dc..9d26a5bc394d 100644 > --- a/fs/fuse/inode.c > +++ b/fs/fuse/inode.c > @@ -101,14 +101,11 @@ static struct inode *fuse_alloc_inode(struct > super_block *sb) > if (!fi) > return NULL; > > - fi->i_time = 0; > + /* Initialize private data (i.e. everything except fi->inode) */ > + BUILD_BUG_ON(offsetof(struct fuse_inode, inode) != 0); > + memset((void *) fi + sizeof(fi->inode), 0, sizeof(*fi) - > sizeof(fi->inode)); > + > fi->inval_mask = ~0; > - fi->nodeid = 0; > - fi->nlookup = 0; > - fi->attr_version = 0; > - fi->orig_ino = 0; > - fi->state = 0; > - fi->submount_lookup = NULL; > mutex_init(&fi->mutex); > spin_lock_init(&fi->lock); > fi->forget = fuse_alloc_forget(); >