This is the mail archive of the
cluster-cvs@sourceware.org
mailing list for the cluster.
RHEL52 - gfs-kernel: GFS: madvise system call causes assertion
- From: Abhijith Das <adas at fedoraproject dot org>
- To: cluster-cvs-relay at redhat dot com
- Date: Thu, 2 Oct 2008 18:23:02 +0000 (UTC)
- Subject: RHEL52 - gfs-kernel: GFS: madvise system call causes assertion
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=2a7d64a767dd447982ce94f5962fd91c5745c492
Commit: 2a7d64a767dd447982ce94f5962fd91c5745c492
Parent: 5b290b492393a61658d4fbb8cc473b30a7fccd74
Author: Abhijith Das <adas@redhat.com>
AuthorDate: Thu Oct 2 13:20:34 2008 -0500
Committer: Abhijith Das <adas@redhat.com>
CommitterDate: Thu Oct 2 13:20:34 2008 -0500
gfs-kernel: GFS: madvise system call causes assertion
Since the madvise system call was enabled by the patch to bug 429343, it's
possible for a inode glock holder to never get dequeued through gfs_readpage.
This causes an assertion (bug 464837)
GFS: fsid=cl102a:gfs1.1: warning: assertion "(gh->gh_flags & LM_FLAG_ANY) ||
(tmp_gh->gh_flags & LM_FLAG_ANY)" failed
GFS: fsid=cl102a:gfs1.1: function = add_to_queue
GFS: fsid=cl102a:gfs1.1: file =
/builddir/build/BUILD/gfs-kmod-0.1.23/_kmod_build_/src/gfs/glock.c, line = 1418
GFS: fsid=cl102a:gfs1.1: time = 1222739610
s patch reverts the patch to bz 429343. Don't log any warnings/errors and
simply return ENOSYS when you arrive at gfs_readpage without the inode glock
held. (madvise syscall case)
---
gfs-kernel/src/gfs/glock.h | 15 ++++++++-------
gfs-kernel/src/gfs/ops_address.c | 29 ++---------------------------
2 files changed, 10 insertions(+), 34 deletions(-)
diff --git a/gfs-kernel/src/gfs/glock.h b/gfs-kernel/src/gfs/glock.h
index fb1e210..37630b0 100644
--- a/gfs-kernel/src/gfs/glock.h
+++ b/gfs-kernel/src/gfs/glock.h
@@ -33,16 +33,16 @@
#define GL_NOCACHE (0x00000400) /* Release glock when done, don't cache */
#define GL_SYNC (0x00000800) /* Sync to disk when no more holders */
#define GL_NOCANCEL (0x00001000) /* Don't ever cancel this request */
-#define GL_READPAGE (0x00002000) /* gfs_readpage() issued this lock request */
#define GLR_TRYFAILED (13)
#define GLR_CANCELED (14)
-static __inline__ struct gfs_holder*
+static __inline__ int
gfs_glock_is_locked_by_me(struct gfs_glock *gl)
{
struct list_head *tmp, *head;
struct gfs_holder *gh;
+ int locked = FALSE;
/* Look in glock's list of holders for one with current task as owner */
spin_lock(&gl->gl_spin);
@@ -50,13 +50,14 @@ gfs_glock_is_locked_by_me(struct gfs_glock *gl)
tmp != head;
tmp = tmp->next) {
gh = list_entry(tmp, struct gfs_holder, gh_list);
- if (gh->gh_owner == current)
- goto out;
+ if (gh->gh_owner == current) {
+ locked = TRUE;
+ break;
+ }
}
- gh = NULL;
-out:
spin_unlock(&gl->gl_spin);
- return gh;
+
+ return locked;
}
static __inline__ int
gfs_glock_is_held_excl(struct gfs_glock *gl)
diff --git a/gfs-kernel/src/gfs/ops_address.c b/gfs-kernel/src/gfs/ops_address.c
index cc64122..c9ce4e5 100644
--- a/gfs-kernel/src/gfs/ops_address.c
+++ b/gfs-kernel/src/gfs/ops_address.c
@@ -272,33 +272,13 @@ gfs_readpage(struct file *file, struct page *page)
{
struct gfs_inode *ip = get_v2ip(page->mapping->host);
struct gfs_sbd *sdp = ip->i_sbd;
- struct gfs_holder *gh;
int error;
atomic_inc(&sdp->sd_ops_address);
- /* When gfs_readpage is called from the sys_madvise code through the
- * readahead code, the inode glock is not held. In this case, we hold
- * the inode glock, unlock the page and return AOP_TRUNCATED_PAGE. The
- * caller will then reload the page and call gfs_readpage again. We
- * also add the flag GL_READPAGE to denote that the glock was held in
- * this function and if so, we unlock it before leaving this function
- */
- gh = gfs_glock_is_locked_by_me(ip->i_gl);
- if (!gh) {
- gh = kmalloc(sizeof(struct gfs_holder), GFP_NOFS);
- if (!gh)
- return -ENOBUFS;
- gfs_holder_init(ip->i_gl, LM_ST_SHARED,
- GL_READPAGE | LM_FLAG_ANY, gh);
+ if (!gfs_glock_is_locked_by_me(ip->i_gl)) {
unlock_page(page);
- error = gfs_glock_nq(gh);
- if (error) {
- gfs_holder_uninit(gh);
- kfree(gh);
- goto out;
- }
- return AOP_TRUNCATED_PAGE;
+ return -ENOSYS;
}
if (!gfs_is_jdata(ip)) {
@@ -313,11 +293,6 @@ gfs_readpage(struct file *file, struct page *page)
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
error = -EIO;
- if (gh->gh_flags & GL_READPAGE) { /* If we grabbed the glock here */
- gfs_glock_dq_uninit(gh);
- kfree(gh);
- }
-out:
return error;
}