NFS: Fix inheritance of the block sizes when automounting
Only inherit the block sizes that were actually specified as mount
parameters for the parent mount.
Fixes: 62a55d088c ("NFS: Additional refactoring for fs_context conversion")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
pull/1354/merge
parent
8675c69816
commit
2b092175f5
|
|
@ -784,10 +784,18 @@ static int nfs_init_server(struct nfs_server *server,
|
||||||
server->fattr_valid = NFS_ATTR_FATTR_V4;
|
server->fattr_valid = NFS_ATTR_FATTR_V4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->rsize)
|
if (ctx->bsize) {
|
||||||
|
server->bsize = ctx->bsize;
|
||||||
|
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_BSIZE;
|
||||||
|
}
|
||||||
|
if (ctx->rsize) {
|
||||||
server->rsize = nfs_io_size(ctx->rsize, clp->cl_proto);
|
server->rsize = nfs_io_size(ctx->rsize, clp->cl_proto);
|
||||||
if (ctx->wsize)
|
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_RSIZE;
|
||||||
|
}
|
||||||
|
if (ctx->wsize) {
|
||||||
server->wsize = nfs_io_size(ctx->wsize, clp->cl_proto);
|
server->wsize = nfs_io_size(ctx->wsize, clp->cl_proto);
|
||||||
|
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_WSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
server->acregmin = ctx->acregmin * HZ;
|
server->acregmin = ctx->acregmin * HZ;
|
||||||
server->acregmax = ctx->acregmax * HZ;
|
server->acregmax = ctx->acregmax * HZ;
|
||||||
|
|
@ -977,8 +985,13 @@ EXPORT_SYMBOL_GPL(nfs_probe_server);
|
||||||
void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
|
void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_server *source)
|
||||||
{
|
{
|
||||||
target->flags = source->flags;
|
target->flags = source->flags;
|
||||||
target->rsize = source->rsize;
|
target->automount_inherit = source->automount_inherit;
|
||||||
target->wsize = source->wsize;
|
if (source->automount_inherit & NFS_AUTOMOUNT_INHERIT_BSIZE)
|
||||||
|
target->bsize = source->bsize;
|
||||||
|
if (source->automount_inherit & NFS_AUTOMOUNT_INHERIT_RSIZE)
|
||||||
|
target->rsize = source->rsize;
|
||||||
|
if (source->automount_inherit & NFS_AUTOMOUNT_INHERIT_WSIZE)
|
||||||
|
target->wsize = source->wsize;
|
||||||
target->acregmin = source->acregmin;
|
target->acregmin = source->acregmin;
|
||||||
target->acregmax = source->acregmax;
|
target->acregmax = source->acregmax;
|
||||||
target->acdirmin = source->acdirmin;
|
target->acdirmin = source->acdirmin;
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,6 @@ struct nfs_fs_context {
|
||||||
struct super_block *sb;
|
struct super_block *sb;
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct nfs_fattr *fattr;
|
struct nfs_fattr *fattr;
|
||||||
unsigned int inherited_bsize;
|
|
||||||
} clone_data;
|
} clone_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,10 @@ struct vfsmount *nfs_d_automount(struct path *path)
|
||||||
ctx->nfs_mod = client->cl_nfs_mod;
|
ctx->nfs_mod = client->cl_nfs_mod;
|
||||||
get_nfs_version(ctx->nfs_mod);
|
get_nfs_version(ctx->nfs_mod);
|
||||||
|
|
||||||
|
/* Inherit block sizes if they were specified as mount parameters */
|
||||||
|
if (server->automount_inherit & NFS_AUTOMOUNT_INHERIT_BSIZE)
|
||||||
|
ctx->bsize = server->bsize;
|
||||||
|
|
||||||
ret = client->rpc_ops->submount(fc, server);
|
ret = client->rpc_ops->submount(fc, server);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
mnt = ERR_PTR(ret);
|
mnt = ERR_PTR(ret);
|
||||||
|
|
@ -289,7 +293,6 @@ int nfs_do_submount(struct fs_context *fc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ctx->internal = true;
|
ctx->internal = true;
|
||||||
ctx->clone_data.inherited_bsize = ctx->clone_data.sb->s_blocksize_bits;
|
|
||||||
|
|
||||||
p = nfs_devname(dentry, buffer, 4096);
|
p = nfs_devname(dentry, buffer, 4096);
|
||||||
if (IS_ERR(p)) {
|
if (IS_ERR(p)) {
|
||||||
|
|
|
||||||
|
|
@ -1179,10 +1179,20 @@ static int nfs4_init_server(struct nfs_server *server, struct fs_context *fc)
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
if (ctx->rsize)
|
if (ctx->bsize) {
|
||||||
server->rsize = nfs_io_size(ctx->rsize, server->nfs_client->cl_proto);
|
server->bsize = ctx->bsize;
|
||||||
if (ctx->wsize)
|
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_BSIZE;
|
||||||
server->wsize = nfs_io_size(ctx->wsize, server->nfs_client->cl_proto);
|
}
|
||||||
|
if (ctx->rsize) {
|
||||||
|
server->rsize =
|
||||||
|
nfs_io_size(ctx->rsize, server->nfs_client->cl_proto);
|
||||||
|
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_RSIZE;
|
||||||
|
}
|
||||||
|
if (ctx->wsize) {
|
||||||
|
server->wsize =
|
||||||
|
nfs_io_size(ctx->wsize, server->nfs_client->cl_proto);
|
||||||
|
server->automount_inherit |= NFS_AUTOMOUNT_INHERIT_WSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
server->acregmin = ctx->acregmin * HZ;
|
server->acregmin = ctx->acregmin * HZ;
|
||||||
server->acregmax = ctx->acregmax * HZ;
|
server->acregmax = ctx->acregmax * HZ;
|
||||||
|
|
|
||||||
|
|
@ -1091,8 +1091,9 @@ static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
|
||||||
sb->s_blocksize = 0;
|
sb->s_blocksize = 0;
|
||||||
sb->s_xattr = server->nfs_client->cl_nfs_mod->xattr;
|
sb->s_xattr = server->nfs_client->cl_nfs_mod->xattr;
|
||||||
sb->s_op = server->nfs_client->cl_nfs_mod->sops;
|
sb->s_op = server->nfs_client->cl_nfs_mod->sops;
|
||||||
if (ctx->bsize)
|
if (server->bsize)
|
||||||
sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits);
|
sb->s_blocksize =
|
||||||
|
nfs_block_size(server->bsize, &sb->s_blocksize_bits);
|
||||||
|
|
||||||
switch (server->nfs_client->rpc_ops->version) {
|
switch (server->nfs_client->rpc_ops->version) {
|
||||||
case 2:
|
case 2:
|
||||||
|
|
@ -1338,13 +1339,8 @@ int nfs_get_tree_common(struct fs_context *fc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->s_root) {
|
if (!s->s_root) {
|
||||||
unsigned bsize = ctx->clone_data.inherited_bsize;
|
|
||||||
/* initial superblock/root creation */
|
/* initial superblock/root creation */
|
||||||
nfs_fill_super(s, ctx);
|
nfs_fill_super(s, ctx);
|
||||||
if (bsize) {
|
|
||||||
s->s_blocksize_bits = bsize;
|
|
||||||
s->s_blocksize = 1U << bsize;
|
|
||||||
}
|
|
||||||
error = nfs_get_cache_cookie(s, ctx);
|
error = nfs_get_cache_cookie(s, ctx);
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto error_splat_super;
|
goto error_splat_super;
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,11 @@ struct nfs_server {
|
||||||
#define NFS_MOUNT_FORCE_RDIRPLUS 0x20000000
|
#define NFS_MOUNT_FORCE_RDIRPLUS 0x20000000
|
||||||
#define NFS_MOUNT_NETUNREACH_FATAL 0x40000000
|
#define NFS_MOUNT_NETUNREACH_FATAL 0x40000000
|
||||||
|
|
||||||
|
unsigned int automount_inherit; /* Properties inherited by automount */
|
||||||
|
#define NFS_AUTOMOUNT_INHERIT_BSIZE 0x0001
|
||||||
|
#define NFS_AUTOMOUNT_INHERIT_RSIZE 0x0002
|
||||||
|
#define NFS_AUTOMOUNT_INHERIT_WSIZE 0x0004
|
||||||
|
|
||||||
unsigned int caps; /* server capabilities */
|
unsigned int caps; /* server capabilities */
|
||||||
__u64 fattr_valid; /* Valid attributes */
|
__u64 fattr_valid; /* Valid attributes */
|
||||||
unsigned int rsize; /* read size */
|
unsigned int rsize; /* read size */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue