All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Rockai <prockai@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] DRAFT! write lock priority
Date: Thu, 13 Aug 2009 14:54:15 +0200	[thread overview]
Message-ID: <87fxbvub60.fsf@twilight.int.mornfall.net.> (raw)
In-Reply-To: <20090812223551.GQ7033@agk-dp.fab.redhat.com> (Alasdair G. Kergon's message of "Wed, 12 Aug 2009 23:35:51 +0100")

Hi,

Alasdair G Kergon <agk@redhat.com> writes:
> I'm still not sure what best to call it, without it becoming rather too long.
> I reckon 'prioritisation' works better than 'priority' though with this
> proposal i.e. global/write_lock_prioritisation.
> That it only (currently) affects "local file-based locking (type 1)" can be
> covered by the comments in example.conf.
Yes, that should be documented indeed.

> Add a comment to show what the result of this code is.
> "aux_" is a decent idea for the prefix: any other ideas?
> Something based on 'waiting' or 'queue'?
> Best might be a suffix on the existing name, with a separator
> character that cannot appear in a VG name.
>    V_vg1:queue
> Then a sorted 'ls' will list them adacently.
I have thought about that at first (it was actually easier to implement), but I
decided against because it feels fragile. So unless you think it's worth it,
I'd stick with the prefix solution, which is I think quite foolproof.

> @@ -207,7 +216,22 @@ static int _lock_file(const char *file, 
>  	log_very_verbose("Locking %s %c%c", ll->res, state,
>  			 nonblock ? ' ' : 'B');
>  
> We may be missing some further log messages here: I want
> every flock operation logged.  Maybe the messages should move to
> _do_flock / _undo_flock, or we should just have additional log_debug ones
> at this level for the new calls.
Ok.

>
> -	r = _do_flock(file, &ll->lf, operation, nonblock);
> +	if (!_write_priority) {
> +		r = _do_flock(file, &ll->lf, operation, nonblock);
> +	else {
> +		if (flags & LCK_WRITE) {
> +			if ((r = _do_flock(file_aux, &fd_aux, LOCK_EX, nonblock))) {
>
> Ah - something got missed here:  In the design, all these fd_aux locking
> operations block if the lock is not available, so remove 'nonblock' from those 2
> lines.  (I don't see that causing any deadlocks, and it removes avoidable
> failure modes.)  Non-blocking locks in LVM are only used to avoid deadlocks -
> waiting is always acceptable (but will permit the ctrl-c option).
Ok, that makes sense. I didn't realize right away we only want nonblocking for
deadlock avoidance.

I'll check the refactor patch in, and amend the actual-fix one and send it in a
while.

Yours,
   Petr.



  parent reply	other threads:[~2009-08-13 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12  7:40 [PATCH] DRAFT! write lock priority Petr Rockai
2009-08-12 20:29 ` Alasdair G Kergon
2009-08-12 22:35 ` Alasdair G Kergon
2009-08-12 22:50   ` Alasdair G Kergon
2009-08-13 10:02     ` Milan Broz
2009-08-13 15:00     ` Petr Rockai
2009-08-14 12:52       ` Petr Rockai
2009-08-14 17:16         ` Alasdair G Kergon
2009-08-13 12:54   ` Petr Rockai [this message]
2009-08-13 20:46     ` Alasdair G Kergon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fxbvub60.fsf@twilight.int.mornfall.net. \
    --to=prockai@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.