From: Mark Fasheh <mark.fasheh@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, ocfs2-devel@oss.oracle.com
Subject: Re: [PATCH 03/30] ocfs2: Remove mount/unmount votes
Date: Wed, 23 Jan 2008 17:02:22 -0800 [thread overview]
Message-ID: <20080124010222.GN23506@ca-server1.us.oracle.com> (raw)
In-Reply-To: <20080123140509.4db5fb47.akpm@linux-foundation.org>
Andrew, thanks for the review.
On Wed, Jan 23, 2008 at 02:05:09PM -0800, Andrew Morton wrote:
> > On Thu, 17 Jan 2008 14:35:29 -0800 Mark Fasheh <mark.fasheh@oracle.com> wrote:
> > The node maps that are set/unset by these votes are no longer relevant, thus
> > we can remove the mount and umount votes. Since those are the last two
> > remaining votes, we can also remove the entire vote infrastructure.
> >
> > The vote thread has been renamed to the downconvert thread, and the small
> > amount of functionality related to managing it has been moved into
> > fs/ocfs2/dlmglue.c. All references to votes have been removed or updated.
> >
>
> Locking looks fishy.
Btw, the downconvert code is functionally identical from what was in vote.c
for years now. It just got moved into dlmglue.c and renamed.
> > +static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb)
> > +{
> > + unsigned long processed;
> > + struct ocfs2_lock_res *lockres;
> > +
> > + mlog_entry_void();
> > +
> > + spin_lock(&osb->dc_task_lock);
> > + /* grab this early so we know to try again if a state change and
> > + * wake happens part-way through our work */
> > + osb->dc_work_sequence = osb->dc_wake_sequence;
> > +
> > + processed = osb->blocked_lock_count;
> > + while (processed) {
> > + BUG_ON(list_empty(&osb->blocked_lock_list));
> > +
> > + lockres = list_entry(osb->blocked_lock_list.next,
> > + struct ocfs2_lock_res, l_blocked_list);
> > + list_del_init(&lockres->l_blocked_list);
> > + osb->blocked_lock_count--;
> > + spin_unlock(&osb->dc_task_lock);
> > +
> > + BUG_ON(!processed);
> > + processed--;
> > +
> > + ocfs2_process_blocked_lock(osb, lockres);
> > +
> > + spin_lock(&osb->dc_task_lock);
> > + }
> > + spin_unlock(&osb->dc_task_lock);
>
> Once the lock has been dropped there is (apparently) nothing to prevent
> alteration of the list and of ->blocked_lock_count. If this happens,
> either items will be missed or we go BUG.
The rule is that only the downconvert thread is allowed to remove locks from
that list. Everyone else just decides a lock needs downconverting and queues
it.
Attached to this e-mail is a patch to better document this.
> > + mlog_exit_void();
> > +}
> > +
> > +static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb)
> > +{
> > + int empty = 0;
> > +
> > + spin_lock(&osb->dc_task_lock);
> > + if (list_empty(&osb->blocked_lock_list))
> > + empty = 1;
> > +
> > + spin_unlock(&osb->dc_task_lock);
> > + return empty;
> > +}
>
> This function appears to be returning a value which is unreliable once the
> lock was dropped.
In this case that's ok. It's only used during dlmglue shutdown when no new
locks should ever be queued.
> > +static int ocfs2_downconvert_thread_should_wake(struct ocfs2_super *osb)
> > +{
> > + int should_wake = 0;
> > +
> > + spin_lock(&osb->dc_task_lock);
> > + if (osb->dc_work_sequence != osb->dc_wake_sequence)
> > + should_wake = 1;
> > + spin_unlock(&osb->dc_task_lock);
> > +
> > + return should_wake;
> > +}
>
> Ditto.
Another case where it's ok :)
> > +int ocfs2_downconvert_thread(void *arg)
> > +{
> > + int status = 0;
> > + struct ocfs2_super *osb = arg;
> > +
> > + /* only quit once we've been asked to stop and there is no more
> > + * work available */
> > + while (!(kthread_should_stop() &&
> > + ocfs2_downconvert_thread_lists_empty(osb))) {
>
> Extra whitespace
Ok, a cleanup of this and the other whitespace problems you pointed out (in
resize.c) have been commited to the tree.
--Mark
--
Mark Fasheh
Principal Software Developer, Oracle
mark.fasheh@oracle.com
From: Mark Fasheh <mark.fasheh@oracle.com>
ocfs2: document access rules for blocked_lock_list
ocfs2_super->blocked_lock_list and ocfs2_super->blocked_lock_count have some
usage restrictions which aren't immediately obvious to anyone reading the
code. It's a good idea to document this so that we avoid making costly
mistakes in the future.
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
---
fs/ocfs2/ocfs2.h | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 22e334d..d084805 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -262,6 +262,12 @@ struct ocfs2_super
unsigned long dc_wake_sequence;
unsigned long dc_work_sequence;
+ /*
+ * Any thread can add locks to the list, but the downconvert
+ * thread is the only one allowed to remove locks. Any change
+ * to this rule requires updating
+ * ocfs2_downconvert_thread_do_work().
+ */
struct list_head blocked_lock_list;
unsigned long blocked_lock_count;
--
1.5.3.6
next prev parent reply other threads:[~2008-01-24 1:03 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-17 22:35 [PATCH 0/30] Ocfs2 and Configfs patches for 2.6.25-rc1 Mark Fasheh
2008-01-17 22:35 ` [PATCH 01/30] ocfs2_dlm: Call node eviction callbacks from heartbeat handler Mark Fasheh
2008-01-17 22:35 ` [PATCH 02/30] ocfs2: Remove fs dependency on ocfs2_heartbeat module Mark Fasheh
2008-01-17 22:35 ` [PATCH 03/30] ocfs2: Remove mount/unmount votes Mark Fasheh
2008-01-23 22:05 ` Andrew Morton
2008-01-24 1:02 ` Mark Fasheh [this message]
2008-01-17 22:35 ` [PATCH 04/30] ocfs2: Add data downconvert worker to inode lock Mark Fasheh
2008-01-17 22:35 ` [PATCH 05/30] ocfs2: Remove data locks Mark Fasheh
2008-01-17 22:35 ` [PATCH 06/30] ocfs2: Rename ocfs2_meta_[un]lock Mark Fasheh
2008-01-17 22:35 ` [PATCH 07/30] dlm: Split lock mode and flag constants into a sharable header Mark Fasheh
2008-01-17 22:35 ` [PATCH 08/30] ocfs2: Readpages support Mark Fasheh
2008-01-23 22:05 ` Andrew Morton
2008-01-24 1:20 ` Mark Fasheh
2008-01-17 22:35 ` [PATCH 09/30] ocfs2: Documentation update Mark Fasheh
2008-01-17 22:35 ` [PATCH 10/30] ocfs2: Initalize bitmap_cpg of ocfs2_super to be the maximum Mark Fasheh
2008-01-17 22:35 ` [PATCH 11/30] ocfs2: Reserve ioctl range Mark Fasheh
2008-01-17 22:35 ` [PATCH 12/30] ocfs2: Add group extend for online resize Mark Fasheh
2008-01-23 22:05 ` Andrew Morton
2008-01-24 3:14 ` Mark Fasheh
2008-01-17 22:35 ` [PATCH 13/30] ocfs2: Implement group add " Mark Fasheh
2008-01-23 22:05 ` Andrew Morton
2008-01-24 2:48 ` Mark Fasheh
2008-01-17 22:35 ` [PATCH 14/30] ocfs2: Add missing permission checks Mark Fasheh
2008-01-17 22:35 ` [PATCH 15/30] ocfs2: build warnings fix Mark Fasheh
2008-01-17 22:35 ` [PATCH 16/30] ocfs2: Support commit= mount option Mark Fasheh
2008-01-17 22:35 ` [PATCH 17/30] ocfs2: Local alloc window size changeable via " Mark Fasheh
2008-01-17 22:35 ` [PATCH 18/30] ocfs2: add flock lock type Mark Fasheh
2008-01-17 22:35 ` [PATCH 19/30] ocfs2: cluster aware flock() Mark Fasheh
2008-01-17 22:35 ` [PATCH 20/30] ocfs2: Silence false lockdep warnings Mark Fasheh
2008-01-17 22:35 ` [PATCH 21/30] ocfs2: Safer read_inline_data() Mark Fasheh
2008-01-17 22:35 ` [PATCH 22/30] ocfs2: Use generic_file_llseek Mark Fasheh
2008-01-17 22:35 ` [PATCH 23/30] ocfs2: printf fixes Mark Fasheh
2008-01-17 22:35 ` [PATCH 24/30] ocfs2: Update default cluster timeouts Mark Fasheh
2008-01-17 22:35 ` [PATCH 25/30] ocfs2: convert byte order of constant instead of variable Mark Fasheh
2008-01-17 22:35 ` [PATCH 26/30] ocfs2/dlm: Clear joining_node on hearbeat node down Mark Fasheh
2008-01-17 22:35 ` [PATCH 27/30] ocfs2: bump version number Mark Fasheh
2008-01-17 22:35 ` [PATCH 28/30] configfs: Remove EXPERIMENTAL Mark Fasheh
2008-01-17 22:35 ` [PATCH 29/30] configfs: dir.c fix possible recursive locking Mark Fasheh
2008-01-17 22:35 ` [PATCH 30/30] configfs: file.c " Mark Fasheh
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=20080124010222.GN23506@ca-server1.us.oracle.com \
--to=mark.fasheh@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ocfs2-devel@oss.oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox