All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Fix udev synchronization for no-locking mode
       [not found] <cover.1296484980.git.zkabelac@redhat.com>
@ 2011-01-31 14:44 ` Zdenek Kabelac
  2011-01-31 15:12   ` Petr Rockai
  0 siblings, 1 reply; 4+ messages in thread
From: Zdenek Kabelac @ 2011-01-31 14:44 UTC (permalink / raw)
  To: lvm-devel

Instead of implicitly syncing udev operation in  clustered and
file locking code -  call  syncing directly in lock_vol when
the operation unlocks VG

Currently problem is missing implicit fs_unlock() in the no_locking code.
This is used with --sysinit on read-only filesystem.  In this case
vgchange -ay could exit before all udev nodes are properly synchronised
and may cause problems with accessing such node right after
vgchange --sysinint command is finished.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
 daemons/clvmd/clvmd-command.c |    1 -
 lib/locking/file_locking.c    |    1 -
 lib/locking/locking.c         |    4 ++++
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c
index 3872702..6d0dee4 100644
--- a/daemons/clvmd/clvmd-command.c
+++ b/daemons/clvmd/clvmd-command.c
@@ -217,7 +217,6 @@ static int lock_vg(struct local_client *client)
 	if (lkid == 0)
 	    return EINVAL;
 
-	lvm_do_fs_unlock(); /* Wait for devices */
 	status = sync_unlock(lockname, lkid);
 	if (status)
 	    status = errno;
diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c
index 0c8bbed..68b0420 100644
--- a/lib/locking/file_locking.c
+++ b/lib/locking/file_locking.c
@@ -215,7 +215,6 @@ static int _lock_file(const char *file, uint32_t flags)
 		state = 'W';
 		break;
 	case LCK_UNLOCK:
-		fs_unlock(); /* Wait until devices are available */
 		return _release_lock(file, 1);
 	default:
 		log_error("Unrecognised lock type: %d", flags & LCK_TYPE_MASK);
diff --git a/lib/locking/locking.c b/lib/locking/locking.c
index 645f25d..c923610 100644
--- a/lib/locking/locking.c
+++ b/lib/locking/locking.c
@@ -442,6 +442,10 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
 		/* If LVM1 driver knows about the VG, it can't be accessed. */
 		if (!check_lvm1_vg_inactive(cmd, vol))
 			return_0;
+
+		/* Before unlocking VG wait until devices are available. */
+		if ((flags & LCK_TYPE_MASK) == LCK_UNLOCK)
+			sync_local_dev_names(cmd);
 		break;
 	case LCK_LV:
 		/* All LV locks are non-blocking. */
-- 
1.7.3.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 1/1] Fix udev synchronization for no-locking mode
  2011-01-31 14:44 ` [PATCH 1/1] Fix udev synchronization for no-locking mode Zdenek Kabelac
@ 2011-01-31 15:12   ` Petr Rockai
  2011-01-31 16:20     ` Peter Rajnoha
  2011-01-31 19:37     ` Alasdair G Kergon
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Rockai @ 2011-01-31 15:12 UTC (permalink / raw)
  To: lvm-devel

Hi,

looks OK, although one thing is definitely puzzling: the udev wait is
mentioned in 3 places (2 removals and 1 addition) in the patch:
nevertheless, no two places agree on which function to use for
that. It'd be good to know why is that? (I can sort of understand that
clvmd has a wrapper, but the removed functions still don't agree with
the added one.)

Other than that, ack.

On a second thought: are we sure this is not going to break clvmd?
Please double-check that. There was trouble with that recently, IIRC.

Zdenek Kabelac <zkabelac@redhat.com> writes:

> Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>

> diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c
> index 3872702..6d0dee4 100644
> --- a/daemons/clvmd/clvmd-command.c
> +++ b/daemons/clvmd/clvmd-command.c
> @@ -217,7 +217,6 @@ static int lock_vg(struct local_client *client)
>  	if (lkid == 0)
>  	    return EINVAL;
>  
> -	lvm_do_fs_unlock(); /* Wait for devices */
>  	status = sync_unlock(lockname, lkid);
>  	if (status)
>  	    status = errno;
> diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c
> index 0c8bbed..68b0420 100644
> --- a/lib/locking/file_locking.c
> +++ b/lib/locking/file_locking.c
> @@ -215,7 +215,6 @@ static int _lock_file(const char *file, uint32_t flags)
>  		state = 'W';
>  		break;
>  	case LCK_UNLOCK:
> -		fs_unlock(); /* Wait until devices are available */
>  		return _release_lock(file, 1);
>  	default:
>  		log_error("Unrecognised lock type: %d", flags & LCK_TYPE_MASK);
> diff --git a/lib/locking/locking.c b/lib/locking/locking.c
> index 645f25d..c923610 100644
> --- a/lib/locking/locking.c
> +++ b/lib/locking/locking.c
> @@ -442,6 +442,10 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
>  		/* If LVM1 driver knows about the VG, it can't be accessed. */
>  		if (!check_lvm1_vg_inactive(cmd, vol))
>  			return_0;
> +
> +		/* Before unlocking VG wait until devices are available. */
> +		if ((flags & LCK_TYPE_MASK) == LCK_UNLOCK)
> +			sync_local_dev_names(cmd);
>  		break;
>  	case LCK_LV:
>  		/* All LV locks are non-blocking. */



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] Fix udev synchronization for no-locking mode
  2011-01-31 15:12   ` Petr Rockai
@ 2011-01-31 16:20     ` Peter Rajnoha
  2011-01-31 19:37     ` Alasdair G Kergon
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Rajnoha @ 2011-01-31 16:20 UTC (permalink / raw)
  To: lvm-devel

On 01/31/2011 04:12 PM +0100, Petr Rockai wrote:
> On a second thought: are we sure this is not going to break clvmd?
> Please double-check that. There was trouble with that recently, IIRC.

...seems it's working fine (no locking/file locking/cluster locking).
The nodes are always synced now.

>> Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
> Reviewed-by: Petr Rockai <prockai@redhat.com>
Tested-by: Peter Rajnoha <prajnoha@redhat.com>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] Fix udev synchronization for no-locking mode
  2011-01-31 15:12   ` Petr Rockai
  2011-01-31 16:20     ` Peter Rajnoha
@ 2011-01-31 19:37     ` Alasdair G Kergon
  1 sibling, 0 replies; 4+ messages in thread
From: Alasdair G Kergon @ 2011-01-31 19:37 UTC (permalink / raw)
  To: lvm-devel

On Mon, Jan 31, 2011 at 04:12:54PM +0100, Peter Rockai wrote:
> nevertheless, no two places agree on which function to use for
> that. 

Indeed - can this be fixed without a recursive lock_vol call?

Alasdair



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-31 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1296484980.git.zkabelac@redhat.com>
2011-01-31 14:44 ` [PATCH 1/1] Fix udev synchronization for no-locking mode Zdenek Kabelac
2011-01-31 15:12   ` Petr Rockai
2011-01-31 16:20     ` Peter Rajnoha
2011-01-31 19:37     ` Alasdair G Kergon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.