Skip to content

Commit 0f44da5

Browse files
fllindenTrond Myklebust
authored andcommitted
nfs: define and use the NFS_INO_INVALID_XATTR flag
Define the NFS_INO_INVALID_XATTR flag, to be used for the NFSv4.2 xattr cache, and use it where appropriate. No functional change as yet. Signed-off-by: Frank van der Linden <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent 1b523ca commit 0f44da5

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

fs/nfs/inode.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags)
204204
flags &= ~NFS_INO_INVALID_OTHER;
205205
flags &= ~(NFS_INO_INVALID_CHANGE
206206
| NFS_INO_INVALID_SIZE
207-
| NFS_INO_REVAL_PAGECACHE);
207+
| NFS_INO_REVAL_PAGECACHE
208+
| NFS_INO_INVALID_XATTR);
208209
}
209210

210211
if (inode->i_mapping->nrpages == 0)
@@ -542,6 +543,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr, st
542543
inode->i_gid = fattr->gid;
543544
else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP))
544545
nfs_set_cache_invalid(inode, NFS_INO_INVALID_OTHER);
546+
if (nfs_server_capable(inode, NFS_CAP_XATTR))
547+
nfs_set_cache_invalid(inode, NFS_INO_INVALID_XATTR);
545548
if (fattr->valid & NFS_ATTR_FATTR_BLOCKS_USED)
546549
inode->i_blocks = fattr->du.nfs2.blocks;
547550
if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) {
@@ -1375,6 +1378,8 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
13751378
inode_set_iversion_raw(inode, fattr->change_attr);
13761379
if (S_ISDIR(inode->i_mode))
13771380
nfs_set_cache_invalid(inode, NFS_INO_INVALID_DATA);
1381+
else if (nfs_server_capable(inode, NFS_CAP_XATTR))
1382+
nfs_set_cache_invalid(inode, NFS_INO_INVALID_XATTR);
13781383
}
13791384
/* If we have atomic WCC data, we may update some attributes */
13801385
ts = inode->i_ctime;

fs/nfs/nfs4proc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,8 @@ nfs4_update_changeattr_locked(struct inode *inode,
11831183

11841184
if (cinfo->before != inode_peek_iversion_raw(inode))
11851185
nfsi->cache_validity |= NFS_INO_INVALID_ACCESS |
1186-
NFS_INO_INVALID_ACL;
1186+
NFS_INO_INVALID_ACL |
1187+
NFS_INO_INVALID_XATTR;
11871188
}
11881189
inode_set_iversion_raw(inode, cinfo->after);
11891190
nfsi->read_cache_jiffies = timestamp;

fs/nfs/nfstrace.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ TRACE_DEFINE_ENUM(NFS_INO_INVALID_OTHER);
5959
{ NFS_INO_INVALID_CTIME, "INVALID_CTIME" }, \
6060
{ NFS_INO_INVALID_MTIME, "INVALID_MTIME" }, \
6161
{ NFS_INO_INVALID_SIZE, "INVALID_SIZE" }, \
62-
{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" })
62+
{ NFS_INO_INVALID_OTHER, "INVALID_OTHER" }, \
63+
{ NFS_INO_INVALID_XATTR, "INVALID_XATTR" })
6364

6465
TRACE_DEFINE_ENUM(NFS_INO_ADVISE_RDPLUS);
6566
TRACE_DEFINE_ENUM(NFS_INO_STALE);

include/linux/nfs_fs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ struct nfs4_copy_state {
234234
#define NFS_INO_DATA_INVAL_DEFER \
235235
BIT(13) /* Deferred cache invalidation */
236236
#define NFS_INO_INVALID_BLOCKS BIT(14) /* cached blocks are invalid */
237+
#define NFS_INO_INVALID_XATTR BIT(15) /* xattrs are invalid */
237238

238239
#define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \
239240
| NFS_INO_INVALID_CTIME \

0 commit comments

Comments
 (0)