Re: [PATCH v2 6/8] NFSv4: Support the offline bit

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

 



On Fri, 2022-01-07 at 09:23 -0500, Anna Schumaker wrote:
> Hi Trond,
> 
> On Tue, Dec 28, 2021 at 3:03 AM <trondmy@xxxxxxxxxx> wrote:
> > 
> > From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
> > 
> > Add tracking of the NFSv4 'offline' attribute.
> > 
> > Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
> > Signed-off-by: Lance Shelton <lance.shelton@xxxxxxxxxxxxxxx>
> > Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
> > ---
> >  fs/nfs/inode.c          | 11 +++++++++++
> >  fs/nfs/nfs4proc.c       |  6 ++++++
> >  fs/nfs/nfs4trace.h      |  3 ++-
> >  fs/nfs/nfs4xdr.c        | 31 ++++++++++++++++++++++++++++++-
> >  include/linux/nfs4.h    |  1 +
> >  include/linux/nfs_fs.h  |  1 +
> >  include/linux/nfs_xdr.h |  5 ++++-
> >  7 files changed, 55 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
> > index 4673b091ea31..33f4410190b6 100644
> > --- a/fs/nfs/inode.c
> > +++ b/fs/nfs/inode.c
> > @@ -528,6 +528,7 @@ nfs_fhget(struct super_block *sb, struct nfs_fh
> > *fh, struct nfs_fattr *fattr)
> >                 nfsi->archive = 0;
> >                 nfsi->hidden = 0;
> >                 nfsi->system = 0;
> > +               nfsi->offline = 0;
> >                 inode_set_iversion_raw(inode, 0);
> >                 inode->i_size = 0;
> >                 clear_nlink(inode);
> > @@ -606,6 +607,10 @@ nfs_fhget(struct super_block *sb, struct
> > nfs_fh *fh, struct nfs_fattr *fattr)
> >                 } else if (fattr_supported &
> > NFS_ATTR_FATTR_SPACE_USED &&
> >                            fattr->size != 0)
> >                         nfs_set_cache_invalid(inode,
> > NFS_INO_INVALID_BLOCKS);
> > +               if (fattr->valid & NFS_ATTR_FATTR_OFFLINE)
> > +                       nfsi->offline = (fattr->hsa_flags &
> > NFS_HSA_OFFLINE) ? 1 : 0;
> > +               else if (fattr_supported & NFS_ATTR_FATTR_OFFLINE)
> > +                       nfs_set_cache_invalid(inode,
> > NFS_INO_INVALID_WINATTR);
> > 
> >                 nfs_setsecurity(inode, fattr);
> > 
> > @@ -2274,6 +2279,12 @@ static int nfs_update_inode(struct inode
> > *inode, struct nfs_fattr *fattr)
> >                 nfsi->cache_validity |=
> >                         save_cache_validity &
> > NFS_INO_INVALID_BLOCKS;
> > 
> > +       if (fattr->valid & NFS_ATTR_FATTR_OFFLINE)
> > +               nfsi->offline = (fattr->hsa_flags &
> > NFS_HSA_OFFLINE) ? 1 : 0;
> > +       else if (fattr_supported & NFS_ATTR_FATTR_OFFLINE)
> > +               nfsi->cache_validity |=
> > +                       save_cache_validity &
> > NFS_INO_INVALID_WINATTR;
> > +
> >         /* Update attrtimeo value if we're out of the unstable
> > period */
> >         if (attr_changed) {
> >                 nfs_inc_stats(inode, NFSIOS_ATTRINVALIDATE);
> > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> > index 4e6cc54016ba..713a71fb3020 100644
> > --- a/fs/nfs/nfs4proc.c
> > +++ b/fs/nfs/nfs4proc.c
> > @@ -219,6 +219,7 @@ const u32 nfs4_fattr_bitmap[3] = {
> >  #ifdef CONFIG_NFS_V4_SECURITY_LABEL
> >         FATTR4_WORD2_SECURITY_LABEL
> >  #endif
> > +       | FATTR4_WORD2_OFFLINE
> >  };
> 
> This won't compile if CONFIG_NFS_V4_SECURITY_LABEL=n:
> 
> fs/nfs/nfs4proc.c:218:9: error: expected expression before ‘|’ token
>   218 |         | FATTR4_WORD2_OFFLINE

Oh... Can you fix it up by just moving that '|' inside the #ifdef?



-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@xxxxxxxxxxxxxxx






[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux