All of lore.kernel.org
 help / color / mirror / Atom feed
From: swhiteho@redhat.com <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 02/18] GFS2: Bring back lvb-related stuff to lock_nolock to support quotas
Date: Wed, 18 Mar 2009 12:23:37 +0000	[thread overview]
Message-ID: <1237379033-28095-3-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1237379033-28095-2-git-send-email-swhiteho@redhat.com>

From: Abhijith Das <adas@redhat.com>

The quota code uses lvbs and this is currently not implemented in
lock_nolock, thereby causing panics when quota is enabled with
lock_nolock. This patch adds the relevant bits.

Signed-off-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/locking.c b/fs/gfs2/locking.c
index 523243a..d3657bc 100644
--- a/fs/gfs2/locking.c
+++ b/fs/gfs2/locking.c
@@ -23,11 +23,74 @@ struct lmh_wrapper {
 	const struct lm_lockops *lw_ops;
 };
 
+struct nolock_lockspace {
+	unsigned int nl_lvb_size;
+};
+
+/**
+ * nolock_get_lock - get a lm_lock_t given a descripton of the lock
+ * @lockspace: the lockspace the lock lives in
+ * @name: the name of the lock
+ * @lockp: return the lm_lock_t here
+ *
+ * Returns: 0 on success, -EXXX on failure
+ */
+
+static int nolock_get_lock(void *lockspace, struct lm_lockname *name,
+                           void **lockp)
+{
+        *lockp = lockspace;
+        return 0;
+}
+
+/**
+ * nolock_put_lock - get rid of a lock structure
+ * @lock: the lock to throw away
+ *
+ */
+
+static void nolock_put_lock(void *lock)
+{
+}
+
+/**
+ * nolock_hold_lvb - hold on to a lock value block
+ * @lock: the lock the LVB is associated with
+ * @lvbp: return the lm_lvb_t here
+ *
+ * Returns: 0 on success, -EXXX on failure
+ */
+
+static int nolock_hold_lvb(void *lock, char **lvbp)
+{
+	struct nolock_lockspace *nl = lock;
+	int error = 0;
+
+	*lvbp = kzalloc(nl->nl_lvb_size, GFP_KERNEL);
+	if (!*lvbp)
+		error = -ENOMEM;
+
+	return error;
+}
+
+/**
+ * nolock_unhold_lvb - release a LVB
+ * @lock: the lock the LVB is associated with
+ * @lvb: the lock value block
+ *
+ */
+
+static void nolock_unhold_lvb(void *lock, char *lvb)
+{
+	kfree(lvb);
+}
+
 static int nolock_mount(char *table_name, char *host_data,
 			lm_callback_t cb, void *cb_data,
 			unsigned int min_lvb_size, int flags,
 			struct lm_lockstruct *lockstruct,
 			struct kobject *fskobj);
+static void nolock_unmount(void *lockspace);
 
 /* List of registered low-level locking protocols.  A file system selects one
    of them by name at mount time, e.g. lock_nolock, lock_dlm. */
@@ -35,6 +98,11 @@ static int nolock_mount(char *table_name, char *host_data,
 static const struct lm_lockops nolock_ops = {
 	.lm_proto_name = "lock_nolock",
 	.lm_mount = nolock_mount,
+	.lm_unmount = nolock_unmount,
+	.lm_get_lock = nolock_get_lock,
+	.lm_put_lock = nolock_put_lock,
+	.lm_hold_lvb = nolock_hold_lvb,
+	.lm_unhold_lvb = nolock_unhold_lvb,
 };
 
 static struct lmh_wrapper nolock_proto  = {
@@ -53,6 +121,7 @@ static int nolock_mount(char *table_name, char *host_data,
 {
 	char *c;
 	unsigned int jid;
+	struct nolock_lockspace *nl;
 
 	c = strstr(host_data, "jid=");
 	if (!c)
@@ -62,15 +131,28 @@ static int nolock_mount(char *table_name, char *host_data,
 		sscanf(c, "%u", &jid);
 	}
 
+	nl = kzalloc(sizeof(struct nolock_lockspace), GFP_KERNEL);
+	if (!nl)
+		return -ENOMEM;
+
+	nl->nl_lvb_size = min_lvb_size;
+
 	lockstruct->ls_jid = jid;
 	lockstruct->ls_first = 1;
 	lockstruct->ls_lvb_size = min_lvb_size;
+	lockstruct->ls_lockspace = nl;
 	lockstruct->ls_ops = &nolock_ops;
 	lockstruct->ls_flags = LM_LSFLAG_LOCAL;
 
 	return 0;
 }
 
+static void nolock_unmount(void *lockspace)
+{
+        struct nolock_lockspace *nl = lockspace;
+        kfree(nl);
+}
+
 /**
  * gfs2_register_lockproto - Register a low-level locking protocol
  * @proto: the protocol definition
-- 
1.6.0.3



WARNING: multiple messages have this Message-ID (diff)
From: swhiteho@redhat.com
To: linux-kernel@vger.kernel.org
Cc: cluster-devel@redhat.com, Abhijith Das <adas@redhat.com>,
	Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 02/18] GFS2: Bring back lvb-related stuff to lock_nolock to support quotas
Date: Wed, 18 Mar 2009 12:23:37 +0000	[thread overview]
Message-ID: <1237379033-28095-3-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1237379033-28095-2-git-send-email-swhiteho@redhat.com>

From: Abhijith Das <adas@redhat.com>

The quota code uses lvbs and this is currently not implemented in
lock_nolock, thereby causing panics when quota is enabled with
lock_nolock. This patch adds the relevant bits.

Signed-off-by: Abhijith Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/locking.c b/fs/gfs2/locking.c
index 523243a..d3657bc 100644
--- a/fs/gfs2/locking.c
+++ b/fs/gfs2/locking.c
@@ -23,11 +23,74 @@ struct lmh_wrapper {
 	const struct lm_lockops *lw_ops;
 };
 
+struct nolock_lockspace {
+	unsigned int nl_lvb_size;
+};
+
+/**
+ * nolock_get_lock - get a lm_lock_t given a descripton of the lock
+ * @lockspace: the lockspace the lock lives in
+ * @name: the name of the lock
+ * @lockp: return the lm_lock_t here
+ *
+ * Returns: 0 on success, -EXXX on failure
+ */
+
+static int nolock_get_lock(void *lockspace, struct lm_lockname *name,
+                           void **lockp)
+{
+        *lockp = lockspace;
+        return 0;
+}
+
+/**
+ * nolock_put_lock - get rid of a lock structure
+ * @lock: the lock to throw away
+ *
+ */
+
+static void nolock_put_lock(void *lock)
+{
+}
+
+/**
+ * nolock_hold_lvb - hold on to a lock value block
+ * @lock: the lock the LVB is associated with
+ * @lvbp: return the lm_lvb_t here
+ *
+ * Returns: 0 on success, -EXXX on failure
+ */
+
+static int nolock_hold_lvb(void *lock, char **lvbp)
+{
+	struct nolock_lockspace *nl = lock;
+	int error = 0;
+
+	*lvbp = kzalloc(nl->nl_lvb_size, GFP_KERNEL);
+	if (!*lvbp)
+		error = -ENOMEM;
+
+	return error;
+}
+
+/**
+ * nolock_unhold_lvb - release a LVB
+ * @lock: the lock the LVB is associated with
+ * @lvb: the lock value block
+ *
+ */
+
+static void nolock_unhold_lvb(void *lock, char *lvb)
+{
+	kfree(lvb);
+}
+
 static int nolock_mount(char *table_name, char *host_data,
 			lm_callback_t cb, void *cb_data,
 			unsigned int min_lvb_size, int flags,
 			struct lm_lockstruct *lockstruct,
 			struct kobject *fskobj);
+static void nolock_unmount(void *lockspace);
 
 /* List of registered low-level locking protocols.  A file system selects one
    of them by name at mount time, e.g. lock_nolock, lock_dlm. */
@@ -35,6 +98,11 @@ static int nolock_mount(char *table_name, char *host_data,
 static const struct lm_lockops nolock_ops = {
 	.lm_proto_name = "lock_nolock",
 	.lm_mount = nolock_mount,
+	.lm_unmount = nolock_unmount,
+	.lm_get_lock = nolock_get_lock,
+	.lm_put_lock = nolock_put_lock,
+	.lm_hold_lvb = nolock_hold_lvb,
+	.lm_unhold_lvb = nolock_unhold_lvb,
 };
 
 static struct lmh_wrapper nolock_proto  = {
@@ -53,6 +121,7 @@ static int nolock_mount(char *table_name, char *host_data,
 {
 	char *c;
 	unsigned int jid;
+	struct nolock_lockspace *nl;
 
 	c = strstr(host_data, "jid=");
 	if (!c)
@@ -62,15 +131,28 @@ static int nolock_mount(char *table_name, char *host_data,
 		sscanf(c, "%u", &jid);
 	}
 
+	nl = kzalloc(sizeof(struct nolock_lockspace), GFP_KERNEL);
+	if (!nl)
+		return -ENOMEM;
+
+	nl->nl_lvb_size = min_lvb_size;
+
 	lockstruct->ls_jid = jid;
 	lockstruct->ls_first = 1;
 	lockstruct->ls_lvb_size = min_lvb_size;
+	lockstruct->ls_lockspace = nl;
 	lockstruct->ls_ops = &nolock_ops;
 	lockstruct->ls_flags = LM_LSFLAG_LOCAL;
 
 	return 0;
 }
 
+static void nolock_unmount(void *lockspace)
+{
+        struct nolock_lockspace *nl = lockspace;
+        kfree(nl);
+}
+
 /**
  * gfs2_register_lockproto - Register a low-level locking protocol
  * @proto: the protocol definition
-- 
1.6.0.3


  reply	other threads:[~2009-03-18 12:23 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18 12:23 [Cluster-devel] [GFS2] Pre-pull patch posting swhiteho
2009-03-18 12:23 ` swhiteho
2009-03-18 12:23 ` [Cluster-devel] [PATCH 01/18] GFS2: Fix remount argument parsing swhiteho
2009-03-18 12:23   ` swhiteho
2009-03-18 12:23   ` swhiteho [this message]
2009-03-18 12:23     ` [PATCH 02/18] GFS2: Bring back lvb-related stuff to lock_nolock to support quotas swhiteho
2009-03-18 12:23     ` [Cluster-devel] [PATCH 03/18] GFS2: change gfs2_quota_scan into a shrinker swhiteho
2009-03-18 12:23       ` swhiteho
2009-03-18 12:23       ` [Cluster-devel] [PATCH 04/18] GFS2: Remove "double" locking in quota swhiteho
2009-03-18 12:23         ` swhiteho
2009-03-18 12:23         ` [Cluster-devel] [PATCH 05/18] GFS2: Merge lock_dlm module into GFS2 swhiteho
2009-03-18 12:23           ` swhiteho
2009-03-18 12:23           ` [Cluster-devel] [PATCH 06/18] GFS2: Remove unused field from glock swhiteho
2009-03-18 12:23             ` swhiteho
2009-03-18 12:23             ` [Cluster-devel] [PATCH 07/18] GFS2: Fix error path ref counting for root inode swhiteho
2009-03-18 12:23               ` swhiteho
2009-03-18 12:23               ` [Cluster-devel] [PATCH 08/18] GFS2: Fix deadlock on journal flush swhiteho
2009-03-18 12:23                 ` swhiteho
2009-03-18 12:23                 ` [Cluster-devel] [PATCH 09/18] GFS2: Support generation of discard requests swhiteho
2009-03-18 12:23                   ` swhiteho
2009-03-18 12:23                   ` [Cluster-devel] [PATCH 10/18] GFS2: Expose UUID via sysfs/uevent swhiteho
2009-03-18 12:23                     ` swhiteho
2009-03-18 12:23                     ` [Cluster-devel] [PATCH 11/18] GFS2: Add a "demote a glock" interface to sysfs swhiteho
2009-03-18 12:23                       ` swhiteho
2009-03-18 12:23                       ` [Cluster-devel] [PATCH 12/18] GFS2: Fix alignment issue and tidy gfs2_bitfit swhiteho
2009-03-18 12:23                         ` swhiteho
2009-03-18 12:23                         ` [Cluster-devel] [PATCH 13/18] GFS2: Support quota/noquota mount arguments swhiteho
2009-03-18 12:23                           ` swhiteho
2009-03-18 12:23                           ` [Cluster-devel] [PATCH 14/18] GFS2: fix sparse warnings: constant is so big it is swhiteho
2009-03-18 12:23                             ` swhiteho
2009-03-18 12:23                             ` [Cluster-devel] [PATCH 15/18] GFS2: fix sparse warning: Should it be static? swhiteho
2009-03-18 12:23                               ` swhiteho
2009-03-18 12:23                               ` [Cluster-devel] [PATCH 16/18] GFS2: Pagecache usage optimization on GFS2 swhiteho
2009-03-18 12:23                                 ` swhiteho
2009-03-18 12:23                                 ` [Cluster-devel] [PATCH 17/18] GFS2: Fix locking bug in failed shared to exclusive conversion swhiteho
2009-03-18 12:23                                   ` swhiteho
2009-03-18 12:23                                   ` [Cluster-devel] [PATCH 18/18] GFS2: Clean up of glops.c swhiteho
2009-03-18 12:23                                     ` swhiteho

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=1237379033-28095-3-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@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.