diff options
author | Abhijith Das <adas@redhat.com> | 2007-09-14 00:35:27 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-10-10 03:56:14 -0400 |
commit | b4c20166dcfca106f0f416bfce200099ed76ab18 (patch) | |
tree | 474e8c3bda161953202793c0801ab00a5b5433de /fs/gfs2/glock.c | |
parent | 1ad38c437fa33f85ba4b6a85ea8c5478ee72d5bd (diff) |
[GFS2] flocks from same process trip kernel BUG at fs/gfs2/glock.c:1118!
This patch adds a new flag to the gfs2_holder structure GL_FLOCK.
It is set on holders of glocks representing flocks. This flag is
checked in add_to_queue() and a process is permitted to queue more
than one holder onto a glock if it is set. This solves the issue
of a process not being able to do multiple flocks on the same file.
Through a single descriptor, a process can now promote and demote
flocks. Through multiple descriptors a process can now queue
multiple flocks on the same file. There's still the problem of
a process deadlocking itself (because gfs2 blocking locks are not
interruptible) by queueing incompatible deadlock.
Signed-off-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r-- | fs/gfs2/glock.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 931368a385c..d631cad0aee 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
@@ -1106,24 +1106,31 @@ static void add_to_queue(struct gfs2_holder *gh) | |||
1106 | if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) | 1106 | if (test_and_set_bit(HIF_WAIT, &gh->gh_iflags)) |
1107 | BUG(); | 1107 | BUG(); |
1108 | 1108 | ||
1109 | existing = find_holder_by_owner(&gl->gl_holders, gh->gh_owner_pid); | 1109 | if (!(gh->gh_flags & GL_FLOCK)) { |
1110 | if (existing) { | 1110 | existing = find_holder_by_owner(&gl->gl_holders, |
1111 | print_symbol(KERN_WARNING "original: %s\n", existing->gh_ip); | 1111 | gh->gh_owner_pid); |
1112 | printk(KERN_INFO "pid : %d\n", existing->gh_owner_pid); | 1112 | if (existing) { |
1113 | printk(KERN_INFO "lock type : %d lock state : %d\n", | 1113 | print_symbol(KERN_WARNING "original: %s\n", |
1114 | existing->gh_gl->gl_name.ln_type, existing->gh_gl->gl_state); | 1114 | existing->gh_ip); |
1115 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); | 1115 | printk(KERN_INFO "pid : %d\n", existing->gh_owner_pid); |
1116 | printk(KERN_INFO "pid : %d\n", gh->gh_owner_pid); | 1116 | printk(KERN_INFO "lock type : %d lock state : %d\n", |
1117 | printk(KERN_INFO "lock type : %d lock state : %d\n", | 1117 | existing->gh_gl->gl_name.ln_type, |
1118 | gl->gl_name.ln_type, gl->gl_state); | 1118 | existing->gh_gl->gl_state); |
1119 | BUG(); | 1119 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); |
1120 | } | 1120 | printk(KERN_INFO "pid : %d\n", gh->gh_owner_pid); |
1121 | 1121 | printk(KERN_INFO "lock type : %d lock state : %d\n", | |
1122 | existing = find_holder_by_owner(&gl->gl_waiters3, gh->gh_owner_pid); | 1122 | gl->gl_name.ln_type, gl->gl_state); |
1123 | if (existing) { | 1123 | BUG(); |
1124 | print_symbol(KERN_WARNING "original: %s\n", existing->gh_ip); | 1124 | } |
1125 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); | 1125 | |
1126 | BUG(); | 1126 | existing = find_holder_by_owner(&gl->gl_waiters3, |
1127 | gh->gh_owner_pid); | ||
1128 | if (existing) { | ||
1129 | print_symbol(KERN_WARNING "original: %s\n", | ||
1130 | existing->gh_ip); | ||
1131 | print_symbol(KERN_WARNING "new: %s\n", gh->gh_ip); | ||
1132 | BUG(); | ||
1133 | } | ||
1127 | } | 1134 | } |
1128 | 1135 | ||
1129 | if (gh->gh_flags & LM_FLAG_PRIORITY) | 1136 | if (gh->gh_flags & LM_FLAG_PRIORITY) |