[Vserver] [PATCH] vserver, quota and vroot fix

From: Jan Rekorajski <baggins_at_sith.mimuw.edu.pl>
Date: Fri 02 Mar 2007 - 00:37:15 GMT
Message-ID: <20070302003715.GA10472@sith.mimuw.edu.pl>

Hi,
The following hunk got lost sometime between 2.6.16 and 2.6.18,
as Network Failure System hit me again, I just _had_ to find out why quota
did not work with latest vserver patches ;)
The patch is so long because quotactl_block() has to be after
vroot_get_real_bdev declaration, the real meat is between
#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
#endif

This is against vserver 2.3 patched kernel:

--- linux-2.6.19/fs/quota.c~ 2007-03-01 19:45:40.694648408 +0100
+++ linux-2.6.19/fs/quota.c 2007-03-02 00:27:24.196276620 +0100
@@ -415,34 +415,6 @@
         return 0;
 }
 
-/*
- * look up a superblock on which quota ops will be performed
- * - use the name of a block device to find the superblock thereon
- */
-static inline struct super_block *quotactl_block(const char __user *special)
-{
-#ifdef CONFIG_BLOCK
- struct block_device *bdev;
- struct super_block *sb;
- char *tmp = getname(special);
-
- if (IS_ERR(tmp))
- return ERR_PTR(PTR_ERR(tmp));
- bdev = lookup_bdev(tmp);
- putname(tmp);
- if (IS_ERR(bdev))
- return ERR_PTR(PTR_ERR(bdev));
- sb = get_super(bdev);
- bdput(bdev);
- if (!sb)
- return ERR_PTR(-ENODEV);
-
- return sb;
-#else
- return ERR_PTR(-ENODEV);
-#endif
-}
-
 #if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
 
 #include <linux/vroot.h>
@@ -481,6 +453,50 @@
 #endif
 
 /*
+ * look up a superblock on which quota ops will be performed
+ * - use the name of a block device to find the superblock thereon
+ */
+static inline struct super_block *quotactl_block(const char __user *special)
+{
+#ifdef CONFIG_BLOCK
+ struct block_device *bdev;
+ struct super_block *sb;
+ char *tmp = getname(special);
+
+ if (IS_ERR(tmp))
+ return ERR_PTR(PTR_ERR(tmp));
+ bdev = lookup_bdev(tmp);
+ putname(tmp);
+ if (IS_ERR(bdev))
+ return ERR_PTR(PTR_ERR(bdev));
+#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
+ if (bdev && bdev->bd_inode &&
+ imajor(bdev->bd_inode) == VROOT_MAJOR) {
+ struct block_device *bdnew = (void *)-EINVAL;
+
+ if (vroot_get_real_bdev)
+ bdnew = vroot_get_real_bdev(bdev);
+ else
+ vxdprintk(VXD_CBIT(misc, 0),
+ "vroot_get_real_bdev not set");
+ bdput(bdev);
+ if (IS_ERR(bdnew))
+ return ERR_PTR(PTR_ERR(bdnew));
+ bdev = bdnew;
+ }
+#endif
+ sb = get_super(bdev);
+ bdput(bdev);
+ if (!sb)
+ return ERR_PTR(-ENODEV);
+
+ return sb;
+#else
+ return ERR_PTR(-ENODEV);
+#endif
+}
+
+/*
  * This is the system call interface. This communicates with
  * the user-level programs. Currently this only supports diskquota
  * calls. Maybe we need to add the process quotas etc. in the future,

HTH, HAND,
Jan

-- 
Jan Rekorajski            |  ALL SUSPECTS ARE GUILTY. PERIOD!
baggins<at>mimuw.edu.pl   |  OTHERWISE THEY WOULDN'T BE SUSPECTS, WOULD THEY?
BOFH, MANIAC              |                   -- TROOPS by Kevin Rubio
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Fri Mar 2 01:19:22 2007
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Fri 02 Mar 2007 - 01:19:27 GMT by hypermail 2.1.8