Skip to content

Commit 200f9d2

Browse files
committed
Merge tag 'nfs-for-5.10-2' of git://git.linux-nfs.org/projects/anna/linux-nfs
Pull NFS client bugfixes from Anna Schumaker: "Stable fixes: - Fix failure to unregister shrinker Other fixes: - Fix unnecessary locking to clear up some contention - Fix listxattr receive buffer size - Fix default mount options for nfsroot" * tag 'nfs-for-5.10-2' of git://git.linux-nfs.org/projects/anna/linux-nfs: NFS: Remove unnecessary inode lock in nfs_fsync_dir() NFS: Remove unnecessary inode locking in nfs_llseek_dir() NFS: Fix listxattr receive buffer size NFSv4.2: fix failure to unregister shrinker nfsroot: Default mount option should ask for built-in NFS version
2 parents af5043c + 11decaf commit 200f9d2

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

fs/nfs/dir.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,6 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
955955

956956
static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
957957
{
958-
struct inode *inode = file_inode(filp);
959958
struct nfs_open_dir_context *dir_ctx = filp->private_data;
960959

961960
dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n",
@@ -967,15 +966,15 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
967966
case SEEK_SET:
968967
if (offset < 0)
969968
return -EINVAL;
970-
inode_lock(inode);
969+
spin_lock(&filp->f_lock);
971970
break;
972971
case SEEK_CUR:
973972
if (offset == 0)
974973
return filp->f_pos;
975-
inode_lock(inode);
974+
spin_lock(&filp->f_lock);
976975
offset += filp->f_pos;
977976
if (offset < 0) {
978-
inode_unlock(inode);
977+
spin_unlock(&filp->f_lock);
979978
return -EINVAL;
980979
}
981980
}
@@ -987,7 +986,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
987986
dir_ctx->dir_cookie = 0;
988987
dir_ctx->duped = 0;
989988
}
990-
inode_unlock(inode);
989+
spin_unlock(&filp->f_lock);
991990
return offset;
992991
}
993992

@@ -998,13 +997,9 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence)
998997
static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end,
999998
int datasync)
1000999
{
1001-
struct inode *inode = file_inode(filp);
1002-
10031000
dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync);
10041001

1005-
inode_lock(inode);
1006-
nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
1007-
inode_unlock(inode);
1002+
nfs_inc_stats(file_inode(filp), NFSIOS_VFSFSYNC);
10081003
return 0;
10091004
}
10101005

fs/nfs/nfs42xattr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,8 +1047,10 @@ int __init nfs4_xattr_cache_init(void)
10471047

10481048
void nfs4_xattr_cache_exit(void)
10491049
{
1050+
unregister_shrinker(&nfs4_xattr_large_entry_shrinker);
10501051
unregister_shrinker(&nfs4_xattr_entry_shrinker);
10511052
unregister_shrinker(&nfs4_xattr_cache_shrinker);
1053+
list_lru_destroy(&nfs4_xattr_large_entry_lru);
10521054
list_lru_destroy(&nfs4_xattr_entry_lru);
10531055
list_lru_destroy(&nfs4_xattr_cache_lru);
10541056
kmem_cache_destroy(nfs4_xattr_cache_cachep);

fs/nfs/nfs42xdr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
1 + nfs4_xattr_name_maxsz + 1)
197197
#define decode_setxattr_maxsz (op_decode_hdr_maxsz + decode_change_info_maxsz)
198198
#define encode_listxattrs_maxsz (op_encode_hdr_maxsz + 2 + 1)
199-
#define decode_listxattrs_maxsz (op_decode_hdr_maxsz + 2 + 1 + 1)
199+
#define decode_listxattrs_maxsz (op_decode_hdr_maxsz + 2 + 1 + 1 + 1)
200200
#define encode_removexattr_maxsz (op_encode_hdr_maxsz + 1 + \
201201
nfs4_xattr_name_maxsz)
202202
#define decode_removexattr_maxsz (op_decode_hdr_maxsz + \
@@ -531,7 +531,7 @@ static void encode_listxattrs(struct xdr_stream *xdr,
531531
{
532532
__be32 *p;
533533

534-
encode_op_hdr(xdr, OP_LISTXATTRS, decode_listxattrs_maxsz + 1, hdr);
534+
encode_op_hdr(xdr, OP_LISTXATTRS, decode_listxattrs_maxsz, hdr);
535535

536536
p = reserve_space(xdr, 12);
537537
if (unlikely(!p))

fs/nfs/nfsroot.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@
8888
#define NFS_ROOT "/tftpboot/%s"
8989

9090
/* Default NFSROOT mount options. */
91+
#if defined(CONFIG_NFS_V2)
9192
#define NFS_DEF_OPTIONS "vers=2,tcp,rsize=4096,wsize=4096"
93+
#elif defined(CONFIG_NFS_V3)
94+
#define NFS_DEF_OPTIONS "vers=3,tcp,rsize=4096,wsize=4096"
95+
#else
96+
#define NFS_DEF_OPTIONS "vers=4,tcp,rsize=4096,wsize=4096"
97+
#endif
9298

9399
/* Parameters passed from the kernel command line */
94100
static char nfs_root_parms[NFS_MAXPATHLEN + 1] __initdata = "";

0 commit comments

Comments
 (0)