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

Re: [Cluster-devel] [PATCH] gfs2: add nfslocks mount option



Hi,

The code is ok, but I'm not intending to take this at least until I can
figure out why it is needed. I can't see any use case in which it would
be useful at the moment,

Steve.

On Thu, 2010-03-25 at 16:45 -0500, David Teigland wrote:
> Using the nfslocks mount option causes gfs2 to pass posix locks
> from nfs to the dlm to be clustered.  It is off by default because
> posix locks from nfs are not fully handled by the cluster.
> 
> Signed-off-by: David Teigland <teigland redhat com>
> ---
>  fs/gfs2/file.c   |   11 +++++++++++
>  fs/gfs2/incore.h |    1 +
>  fs/gfs2/super.c  |   13 +++++++++++++
>  3 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
> index e6dd2ae..bd41b37 100644
> --- a/fs/gfs2/file.c
> +++ b/fs/gfs2/file.c
> @@ -650,6 +650,17 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
>  	}
>  	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
>  		return -EIO;
> +
> +	if (fl->fl_lmops && fl->fl_lmops->fl_grant &&
> +	    !sdp->sd_args.ar_nfslocks) {
> +		if (IS_GETLK(cmd)) {
> +			posix_test_lock(file, fl);
> +			return 0;
> +		} else {
> +			return posix_lock_file_wait(file, fl);
> +		}
> +	}
> +
>  	if (IS_GETLK(cmd))
>  		return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl);
>  	else if (fl->fl_type == F_UNLCK)
> diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
> index 3aac46f..31d6991 100644
> --- a/fs/gfs2/incore.h
> +++ b/fs/gfs2/incore.h
> @@ -430,6 +430,7 @@ struct gfs2_args {
>  	unsigned int ar_discard:1;		/* discard requests */
>  	unsigned int ar_errors:2;               /* errors=withdraw | panic */
>  	unsigned int ar_nobarrier:1;            /* do not send barriers */
> +	unsigned int ar_nfslocks:1;             /* pass nfs plocks to dlm */
>  	int ar_commit;				/* Commit interval */
>  	int ar_statfs_quantum;			/* The fast statfs interval */
>  	int ar_quota_quantum;			/* The quota interval */
> diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
> index 50aac60..3a830c8 100644
> --- a/fs/gfs2/super.c
> +++ b/fs/gfs2/super.c
> @@ -77,6 +77,8 @@ enum {
>  	Opt_quota_quantum,
>  	Opt_barrier,
>  	Opt_nobarrier,
> +	Opt_nfslocks,
> +	Opt_nonfslocks,
>  	Opt_error,
>  };
>  
> @@ -113,6 +115,8 @@ static const match_table_t tokens = {
>  	{Opt_quota_quantum, "quota_quantum=%d"},
>  	{Opt_barrier, "barrier"},
>  	{Opt_nobarrier, "nobarrier"},
> +	{Opt_nfslocks, "nfslocks"},
> +	{Opt_nonfslocks, "nonfslocks"},
>  	{Opt_error, NULL}
>  };
>  
> @@ -265,6 +269,12 @@ int gfs2_mount_args(struct gfs2_args *args, char *options)
>  		case Opt_nobarrier:
>  			args->ar_nobarrier = 1;
>  			break;
> +		case Opt_nfslocks:
> +			args->ar_nfslocks = 1;
> +			break;
> +		case Opt_nonfslocks:
> +			args->ar_nfslocks = 0;
> +			break;
>  		case Opt_error:
>  		default:
>  			printk(KERN_WARNING "GFS2: invalid mount option: %s\n", o);
> @@ -1135,6 +1145,7 @@ static int gfs2_remount_fs(struct super_block *sb, int *flags, char *data)
>  	    args_neq(&args, &sdp->sd_args, ignore_local_fs) ||
>  	    args_neq(&args, &sdp->sd_args, localflocks) ||
>  	    args_neq(&args, &sdp->sd_args, localcaching) ||
> +	    args_neq(&args, &sdp->sd_args, nfslocks) ||
>  	    args_neq(&args, &sdp->sd_args, meta))
>  		return -EINVAL;
>  
> @@ -1262,6 +1273,8 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
>  		seq_printf(s, ",localflocks");
>  	if (args->ar_localcaching)
>  		seq_printf(s, ",localcaching");
> +	if (args->ar_nfslocks)
> +		seq_printf(s, ",nfslocks");
>  	if (args->ar_debug)
>  		seq_printf(s, ",debug");
>  	if (args->ar_upgrade)



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