Re: [PATCH] nfs: Set s_time_gran consistently on NFSv2

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

 



Hi Andreas,

> On Sep 12, 2016, at 07:16, Andreas Gruenbacher <agruenba@xxxxxxxxxx> wrote:
> 
> Hi Trond and Anna,
> 
> is it true that nfs_clone_super accidentally sets s_time_gran to 1 on NFSv2?
> If so, could you please merge the following patch?
> 
> Thanks,
> Andreas
> 
> Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
> ---
> fs/nfs/super.c | 25 +++++++++----------------
> 1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index d396013..4c72fec 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -2312,6 +2312,15 @@ inline void nfs_initialise_sb(struct super_block *sb)
> {
> 	struct nfs_server *server = NFS_SB(sb);
> 
> +	if (server->nfs_client->rpc_ops->version != 2) {
> +		sb->s_time_gran = 1;
> +		/*
> +		 * The VFS shouldn't apply the umask to mode bits. We will do
> +		 * so ourselves when necessary.
> +		 */
> +		sb->s_flags |= MS_POSIXACL;
> +	}
> +
> 	sb->s_magic = NFS_SUPER_MAGIC;
> 
> 	/* We probably want something more informative here */
> @@ -2342,14 +2351,6 @@ void nfs_fill_super(struct super_block *sb, struct nfs_mount_info *mount_info)
> 	if (data && data->bsize)
> 		sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits);
> 
> -	if (server->nfs_client->rpc_ops->version != 2) {
> -		/* The VFS shouldn't apply the umask to mode bits. We will do
> -		 * so ourselves when necessary.
> -		 */
> -		sb->s_flags |= MS_POSIXACL;
> -		sb->s_time_gran = 1;
> -	}
> -
>  	nfs_initialise_sb(sb);
> }
> EXPORT_SYMBOL_GPL(nfs_fill_super);
> @@ -2367,14 +2368,6 @@ void nfs_clone_super(struct super_block *sb, struct nfs_mount_info *mount_info)
> 	sb->s_maxbytes = old_sb->s_maxbytes;
> 	sb->s_xattr = old_sb->s_xattr;
> 	sb->s_op = old_sb->s_op;
> -	sb->s_time_gran = 1;
> -
> -	if (server->nfs_client->rpc_ops->version != 2) {
> -		/* The VFS shouldn't apply the umask to mode bits. We will do
> -		 * so ourselves when necessary.
> -		 */
> -		sb->s_flags |= MS_POSIXACL;
> -	}
> 
>  	nfs_initialise_sb(sb);
> }
>

Actually, we should be using the fsinfo->time_delta in nfs_server_set_fsinfo() to set sb->s_time_gran to the precise value supported by the filesystem.
We can then fake up a value for NFSv2, since its ‘statfs’ implementation doesn’t return one.

Cheers
  Trond

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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