Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1404345

Re: [PATCH] ocfs2: insure dlm lockspace is created by kernel module

From Goldwyn Rodrigues <rgoldwyn@suse.de>
Newsgroups linux.kernel
Subject Re: [PATCH] ocfs2: insure dlm lockspace is created by kernel module
Date 2016-05-20 13:10 +0200
Message-ID <rAQtA-4Kg-17@gated-at.bofh.it> (permalink)
References <rANP3-35u-5@gated-at.bofh.it> <rANP4-35u-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Looks good.

Reviewed-by: Goldwyn Rodrigues <rgoldwyn@suse.com>

On 05/20/2016 03:12 AM, Gang He wrote:
> This patch will be used to insure the dlm lockspace is created by kernel
> module when mounting a ocfs2 file system. There are two ways to create a
> lockspace, from user space and kernel space, but the same name lockspaces
> probably have different lvblen lengths/flags.
> To avoid this mix using, we add one more flag DLM_LSFL_NEWEXCL, it will make
> sure the dlm lockspace is created by kernel module when mounting.
> Secondly, if a user space program (ocfs2-tools) is running on a file system,
> the user tries to mount this file system in the cluster, DLM module will return
> a -EEXIST or -EPROTO errno, we should give the user a obvious error message,
> then, the user can let that user space tool exit before mounting the file
> system again.
>
> Signed-off-by: Gang He <ghe@suse.com>
> ---
>   fs/ocfs2/stack_user.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
> index ced70c8..c9e828e 100644
> --- a/fs/ocfs2/stack_user.c
> +++ b/fs/ocfs2/stack_user.c
> @@ -1007,10 +1007,17 @@ static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
>   	lc->oc_type = NO_CONTROLD;
>
>   	rc = dlm_new_lockspace(conn->cc_name, conn->cc_cluster_name,
> -			       DLM_LSFL_FS, DLM_LVB_LEN,
> +			       DLM_LSFL_FS | DLM_LSFL_NEWEXCL, DLM_LVB_LEN,
>   			       &ocfs2_ls_ops, conn, &ops_rv, &fsdlm);
> -	if (rc)
> +	if (rc) {
> +		if (rc == -EEXIST || rc == -EPROTO)
> +			printk(KERN_ERR "ocfs2: Unable to create the "
> +				"lockspace %s (%d), because a ocfs2-tools "
> +				"program is running on this file system "
> +				"with the same name lockspace\n",
> +				conn->cc_name, rc);
>   		goto out;
> +	}
>
>   	if (ops_rv == -EOPNOTSUPP) {
>   		lc->oc_type = WITH_CONTROLD;
>

-- 
Goldwyn

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] ocfs2: adjust arguments in dlm_new_lockspace called by kernel Gang He <ghe@suse.com> - 2016-05-20 10:20 +0200
  [PATCH] ocfs2: insure dlm lockspace is created by kernel module Gang He <ghe@suse.com> - 2016-05-20 10:20 +0200
    Re: [PATCH] ocfs2: insure dlm lockspace is created by kernel module Goldwyn Rodrigues <rgoldwyn@suse.de> - 2016-05-20 13:10 +0200

csiph-web