android_kernel_motorola_sm6225/fs/ocfs2
Joel Becker de551246e7 ocfs2: Remove CANCELGRANT from the view of dlmglue.
o2dlm has the non-standard behavior of providing a cancel callback
(unlock_ast) even when the cancel has failed (the locking operation
succeeded without canceling).  This is called CANCELGRANT after the
status code sent to the callback.  fs/dlm does not provide this
callback, so dlmglue must be changed to live without it.
o2dlm_unlock_ast_wrapper() in stackglue now ignores CANCELGRANT calls.

Because dlmglue no longer sees CANCELGRANT, ocfs2_unlock_ast() no longer
needs to check for it.  ocfs2_locking_ast() must catch that a cancel was
tried and clear the cancel state.

Making these changes opens up a locking race.  dlmglue uses the the
OCFS2_LOCK_BUSY flag to ensure only one thread is calling the dlm at any
one time.  But dlmglue must unlock the lockres before calling into the
dlm.  In the small window of time between unlocking the lockres and
calling the dlm, the downconvert thread can try to cancel the lock.  The
downconvert thread is checking the OCFS2_LOCK_BUSY flag - it doesn't
know that ocfs2_dlm_lock() has not yet been called.

Because ocfs2_dlm_lock() has not yet been called, the cancel operation
will just be a no-op.  There's nothing to cancel.  With CANCELGRANT,
dlmglue uses the CANCELGRANT callback to clear up the cancel state.
When it comes around again, it will retry the cancel.  Eventually, the
first thread will have called into ocfs2_dlm_lock(), and either the
lock or the cancel will succeed.  The downconvert thread can then do its
downconvert.

Without CANCELGRANT, there is nothing to clean up the cancellation
state.  The downconvert thread does not know to retry its operations.
More importantly, the original lock may be blocking on the other node
that is trying to cancel us.  With neither able to make progress, the
ast is never called and the cancellation state is never cleaned up that
way.  dlmglue is deadlocked.

The OCFS2_LOCK_PENDING flag is introduced to remedy this window.  It is
set at the same time OCFS2_LOCK_BUSY is.  Thus, the downconvert thread
can check whether the lock is cancelable.  If not, it just loops around
to try again.  Once ocfs2_dlm_lock() is called, the thread then clears
OCFS2_LOCK_PENDING and wakes the downconvert thread.  Now, if the
downconvert thread finds the lock BUSY, it can safely try to cancel it.
Whether the cancel works or not, the state will be properly set and the
lock processing can continue.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
2008-04-18 08:56:04 -07:00
..
cluster ocfs2: Fix NULL pointer dereferences in o2net 2008-03-10 15:14:19 -07:00
dlm ocfs2/dlm: dlm_thread should not sleep while holding the dlm_spinlock 2008-03-10 15:14:17 -07:00
alloc.c Pagecache zeroing: zero_user_segment, zero_user_segments and zero_user 2008-02-05 09:44:13 -08:00
alloc.h ocfs2: Write support for directories with inline data 2007-10-12 11:54:41 -07:00
aops.c [PATCH] fs/ocfs2/aops.c: Correct use of ! and & 2008-03-03 15:50:21 -08:00
aops.h ocfs2: convert to new aops 2007-10-16 09:42:58 -07:00
buffer_head_io.c ocfs2: clean up bh null checks 2008-01-25 15:05:48 -08:00
buffer_head_io.h [PATCH 1/2] ocfs2: Add group extend for online resize 2008-01-25 14:53:35 -08:00
dcache.c ocfs2: Remove mount/unmount votes 2008-01-25 14:45:34 -08:00
dcache.h ocfs2: Remove special casing for inode creation in ocfs2_dentry_attach_lock() 2006-09-24 13:50:45 -07:00
dir.c [PATCH] ocfs2: le*_add_cpu conversion 2008-03-03 15:50:21 -08:00
dir.h ocfs2: Rename cleanups 2007-10-12 11:54:38 -07:00
dlmglue.c ocfs2: Remove CANCELGRANT from the view of dlmglue. 2008-04-18 08:56:04 -07:00
dlmglue.h ocfs2: Introduce the new ocfs2_cluster_connect/disconnect() API. 2008-04-18 08:56:04 -07:00
export.c ocfs2: Silence false lockdep warnings 2008-01-25 15:05:44 -08:00
export.h exportfs: make struct export_operations const 2007-10-22 08:13:21 -07:00
extent_map.c ocfs2: Read support for inline data 2007-10-12 11:54:39 -07:00
extent_map.h ocfs2: Cache extent records 2007-04-26 15:10:40 -07:00
file.c ocfs2: printf fixes 2008-01-25 15:05:45 -08:00
file.h [PATCH 1/2] ocfs2: add flock lock type 2008-01-25 15:05:43 -08:00
heartbeat.c ocfs2: Move o2hb functionality into the stack glue. 2008-04-18 08:56:04 -07:00
heartbeat.h ocfs2: Move o2hb functionality into the stack glue. 2008-04-18 08:56:04 -07:00
inode.c ocfs2: convert byte order of constant instead of variable 2008-01-25 15:05:46 -08:00
inode.h ocfs2: Silence false lockdep warnings 2008-01-25 15:05:44 -08:00
ioctl.c ocfs2: Move o2hb functionality into the stack glue. 2008-04-18 08:56:04 -07:00
ioctl.h ocfs2: Implement compat_ioctl() 2007-05-02 15:07:16 -07:00
journal.c ocfs2: De-magic the in-memory slot map. 2008-04-18 08:56:03 -07:00
journal.h ocfs2: Change the recovery map to an array of node numbers. 2008-04-18 08:56:02 -07:00
localalloc.c [PATCH] ocfs2: le*_add_cpu conversion 2008-03-03 15:50:21 -08:00
localalloc.h ocfs2: Allow smaller allocations during large writes 2007-09-20 15:06:09 -07:00
locks.c [PATCH 2/2] ocfs2: cluster aware flock() 2008-01-25 15:05:43 -08:00
locks.h [PATCH 2/2] ocfs2: cluster aware flock() 2008-01-25 15:05:43 -08:00
Makefile ocfs2: Separate out dlm lock functions. 2008-04-18 08:56:03 -07:00
mmap.c ocfs2: Rename ocfs2_meta_[un]lock 2008-01-25 14:46:01 -08:00
mmap.h [PATCH] OCFS2: The Second Oracle Cluster Filesystem 2006-01-03 11:45:47 -08:00
namei.c ocfs2: Silence false lockdep warnings 2008-01-25 15:05:44 -08:00
namei.h ocfs2: Move directory manipulation code into dir.c 2007-10-12 11:54:36 -07:00
ocfs1_fs_compat.h fs/: Spelling fixes 2008-02-03 17:33:42 +02:00
ocfs2.h ocfs2: Remove CANCELGRANT from the view of dlmglue. 2008-04-18 08:56:04 -07:00
ocfs2_fs.h ocfs2: New slot map format 2008-04-18 08:56:03 -07:00
ocfs2_lockid.h [PATCH 1/2] ocfs2: add flock lock type 2008-01-25 15:05:43 -08:00
ocfs2_lockingver.h ocfs2: Negotiate locking protocol versions. 2008-02-06 16:11:29 -08:00
resize.c ocfs2: Fix an endian bug in online resize. 2008-03-10 15:14:07 -07:00
resize.h [PATCH 2/2] ocfs2: Implement group add for online resize 2008-01-25 15:04:24 -08:00
slot_map.c ocfs2: Abstract out node number queries. 2008-04-18 08:56:04 -07:00
slot_map.h ocfs2: De-magic the in-memory slot map. 2008-04-18 08:56:03 -07:00
stackglue.c ocfs2: Remove CANCELGRANT from the view of dlmglue. 2008-04-18 08:56:04 -07:00
stackglue.h ocfs2: Move o2hb functionality into the stack glue. 2008-04-18 08:56:04 -07:00
suballoc.c fs/: Spelling fixes 2008-02-03 17:33:42 +02:00
suballoc.h [PATCH 1/2] ocfs2: Add group extend for online resize 2008-01-25 14:53:35 -08:00
super.c ocfs2: Fill node number during cluster stack init 2008-04-18 08:56:04 -07:00
super.h ocfs2: use s_maxbytes directly in ocfs2_change_file_space() 2007-08-09 17:25:07 -07:00
symlink.c mm: make read_cache_page synchronous 2007-05-07 12:12:51 -07:00
symlink.h [PATCH] mark struct inode_operations const 2 2007-02-12 09:48:46 -08:00
sysfile.c ocfs2: Silence false lockdep warnings 2008-01-25 15:05:44 -08:00
sysfile.h [PATCH] OCFS2: The Second Oracle Cluster Filesystem 2006-01-03 11:45:47 -08:00
uptodate.c mm: Remove slab destructors from kmem_cache_create(). 2007-07-20 10:11:58 +09:00
uptodate.h ocfs2: implement directory read-ahead 2006-09-20 15:53:40 -07:00
ver.c ocfs2: bump version number 2008-01-25 15:05:46 -08:00
ver.h [PATCH] OCFS2: The Second Oracle Cluster Filesystem 2006-01-03 11:45:47 -08:00