aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ext2/super.c7
-rw-r--r--fs/ext3/super.c8
-rw-r--r--fs/ext4/super.c8
-rw-r--r--fs/jfs/super.c8
-rw-r--r--fs/ocfs2/super.c14
-rw-r--r--fs/quota/dquot.c77
-rw-r--r--fs/reiserfs/super.c8
-rw-r--r--fs/udf/super.c6
-rw-r--r--fs/ufs/super.c8
9 files changed, 61 insertions, 83 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 73346de9af5c..318ebc58bb7b 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -1250,9 +1250,8 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
1250 es->s_mtime = cpu_to_le32(get_seconds()); 1250 es->s_mtime = cpu_to_le32(get_seconds());
1251 spin_unlock(&sbi->s_lock); 1251 spin_unlock(&sbi->s_lock);
1252 1252
1253 err = vfs_dq_off(sb, 1); 1253 err = dquot_suspend(sb, -1);
1254 if (err < 0 && err != -ENOSYS) { 1254 if (err < 0) {
1255 err = -EBUSY;
1256 spin_lock(&sbi->s_lock); 1255 spin_lock(&sbi->s_lock);
1257 goto restore_opts; 1256 goto restore_opts;
1258 } 1257 }
@@ -1281,7 +1280,7 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
1281 1280
1282 ext2_write_super(sb); 1281 ext2_write_super(sb);
1283 1282
1284 vfs_dq_quota_on_remount(sb); 1283 dquot_resume(sb, -1);
1285 } 1284 }
1286 1285
1287 return 0; 1286 return 0;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index d0f8837b6255..9d5e582b514a 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -2598,11 +2598,9 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2598 } 2598 }
2599 2599
2600 if (*flags & MS_RDONLY) { 2600 if (*flags & MS_RDONLY) {
2601 err = vfs_dq_off(sb, 1); 2601 err = dquot_suspend(sb, -1);
2602 if (err < 0 && err != -ENOSYS) { 2602 if (err < 0)
2603 err = -EBUSY;
2604 goto restore_opts; 2603 goto restore_opts;
2605 }
2606 2604
2607 /* 2605 /*
2608 * First of all, the unconditional stuff we have to do 2606 * First of all, the unconditional stuff we have to do
@@ -2672,7 +2670,7 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2672 unlock_kernel(); 2670 unlock_kernel();
2673 2671
2674 if (enable_quota) 2672 if (enable_quota)
2675 vfs_dq_quota_on_remount(sb); 2673 dquot_resume(sb, -1);
2676 return 0; 2674 return 0;
2677restore_opts: 2675restore_opts:
2678 sb->s_flags = old_sb_flags; 2676 sb->s_flags = old_sb_flags;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index fb1e191d0fa9..08d31101eb05 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3631,11 +3631,9 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3631 } 3631 }
3632 3632
3633 if (*flags & MS_RDONLY) { 3633 if (*flags & MS_RDONLY) {
3634 err = vfs_dq_off(sb, 1); 3634 err = dquot_suspend(sb, -1);
3635 if (err < 0 && err != -ENOSYS) { 3635 if (err < 0)
3636 err = -EBUSY;
3637 goto restore_opts; 3636 goto restore_opts;
3638 }
3639 3637
3640 /* 3638 /*
3641 * First of all, the unconditional stuff we have to do 3639 * First of all, the unconditional stuff we have to do
@@ -3722,7 +3720,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
3722 unlock_super(sb); 3720 unlock_super(sb);
3723 unlock_kernel(); 3721 unlock_kernel();
3724 if (enable_quota) 3722 if (enable_quota)
3725 vfs_dq_quota_on_remount(sb); 3723 dquot_resume(sb, -1);
3726 return 0; 3724 return 0;
3727 3725
3728restore_opts: 3726restore_opts:
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 5329d66a9704..b8a07d4c108e 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -401,14 +401,14 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
401 sb->s_flags &= ~MS_RDONLY; 401 sb->s_flags &= ~MS_RDONLY;
402 402
403 unlock_kernel(); 403 unlock_kernel();
404 vfs_dq_quota_on_remount(sb); 404 dquot_resume(sb, -1);
405 return ret; 405 return ret;
406 } 406 }
407 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { 407 if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
408 rc = vfs_dq_off(sb, 1); 408 rc = dquot_suspend(sb, -1);
409 if (rc < 0 && rc != -ENOSYS) { 409 if (rc < 0) {
410 unlock_kernel(); 410 unlock_kernel();
411 return -EBUSY; 411 return rc;
412 } 412 }
413 rc = jfs_umount_rw(sb); 413 rc = jfs_umount_rw(sb);
414 JFS_SBI(sb)->flag = flag; 414 JFS_SBI(sb)->flag = flag;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 66f9984a983c..0773873d590a 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -879,18 +879,14 @@ static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
879 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) 879 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
880 continue; 880 continue;
881 if (unsuspend) 881 if (unsuspend)
882 status = vfs_quota_enable( 882 status = dquot_resume(sb, type);
883 sb_dqopt(sb)->files[type],
884 type, QFMT_OCFS2,
885 DQUOT_SUSPENDED);
886 else { 883 else {
887 struct ocfs2_mem_dqinfo *oinfo; 884 struct ocfs2_mem_dqinfo *oinfo;
888 885
889 /* Cancel periodic syncing before suspending */ 886 /* Cancel periodic syncing before suspending */
890 oinfo = sb_dqinfo(sb, type)->dqi_priv; 887 oinfo = sb_dqinfo(sb, type)->dqi_priv;
891 cancel_delayed_work_sync(&oinfo->dqi_sync_work); 888 cancel_delayed_work_sync(&oinfo->dqi_sync_work);
892 status = vfs_quota_disable(sb, type, 889 status = dquot_suspend(sb, type);
893 DQUOT_SUSPENDED);
894 } 890 }
895 if (status < 0) 891 if (status < 0)
896 break; 892 break;
@@ -958,8 +954,8 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
958 /* Turn off quotas. This will remove all dquot structures from 954 /* Turn off quotas. This will remove all dquot structures from
959 * memory and so they will be automatically synced to global 955 * memory and so they will be automatically synced to global
960 * quota files */ 956 * quota files */
961 vfs_quota_disable(sb, type, DQUOT_USAGE_ENABLED | 957 dquot_disable(sb, type, DQUOT_USAGE_ENABLED |
962 DQUOT_LIMITS_ENABLED); 958 DQUOT_LIMITS_ENABLED);
963 if (!inode) 959 if (!inode)
964 continue; 960 continue;
965 iput(inode); 961 iput(inode);
@@ -989,7 +985,7 @@ static int ocfs2_quota_off(struct super_block *sb, int type, int remount)
989 if (remount) 985 if (remount)
990 return 0; /* Ignore now and handle later in 986 return 0; /* Ignore now and handle later in
991 * ocfs2_remount() */ 987 * ocfs2_remount() */
992 return vfs_quota_disable(sb, type, DQUOT_LIMITS_ENABLED); 988 return dquot_disable(sb, type, DQUOT_LIMITS_ENABLED);
993} 989}
994 990
995static const struct quotactl_ops ocfs2_quotactl_ops = { 991static const struct quotactl_ops ocfs2_quotactl_ops = {
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 655a4c52b8c3..cf972283e474 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -1865,7 +1865,7 @@ EXPORT_SYMBOL(dquot_file_open);
1865/* 1865/*
1866 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) 1866 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount)
1867 */ 1867 */
1868int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags) 1868int dquot_disable(struct super_block *sb, int type, unsigned int flags)
1869{ 1869{
1870 int cnt, ret = 0; 1870 int cnt, ret = 0;
1871 struct quota_info *dqopt = sb_dqopt(sb); 1871 struct quota_info *dqopt = sb_dqopt(sb);
@@ -1995,14 +1995,16 @@ put_inodes:
1995 } 1995 }
1996 return ret; 1996 return ret;
1997} 1997}
1998EXPORT_SYMBOL(vfs_quota_disable); 1998EXPORT_SYMBOL(dquot_disable);
1999 1999
2000int vfs_quota_off(struct super_block *sb, int type, int remount) 2000int vfs_quota_off(struct super_block *sb, int type, int remount)
2001{ 2001{
2002 return vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED : 2002 BUG_ON(remount);
2003 (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED)); 2003 return dquot_disable(sb, type,
2004 DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
2004} 2005}
2005EXPORT_SYMBOL(vfs_quota_off); 2006EXPORT_SYMBOL(vfs_quota_off);
2007
2006/* 2008/*
2007 * Turn quotas on on a device 2009 * Turn quotas on on a device
2008 */ 2010 */
@@ -2120,34 +2122,41 @@ out_fmt:
2120} 2122}
2121 2123
2122/* Reenable quotas on remount RW */ 2124/* Reenable quotas on remount RW */
2123static int vfs_quota_on_remount(struct super_block *sb, int type) 2125int dquot_resume(struct super_block *sb, int type)
2124{ 2126{
2125 struct quota_info *dqopt = sb_dqopt(sb); 2127 struct quota_info *dqopt = sb_dqopt(sb);
2126 struct inode *inode; 2128 struct inode *inode;
2127 int ret; 2129 int ret = 0, cnt;
2128 unsigned int flags; 2130 unsigned int flags;
2129 2131
2130 mutex_lock(&dqopt->dqonoff_mutex); 2132 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
2131 if (!sb_has_quota_suspended(sb, type)) { 2133 if (type != -1 && cnt != type)
2134 continue;
2135
2136 mutex_lock(&dqopt->dqonoff_mutex);
2137 if (!sb_has_quota_suspended(sb, cnt)) {
2138 mutex_unlock(&dqopt->dqonoff_mutex);
2139 continue;
2140 }
2141 inode = dqopt->files[cnt];
2142 dqopt->files[cnt] = NULL;
2143 spin_lock(&dq_state_lock);
2144 flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
2145 DQUOT_LIMITS_ENABLED,
2146 cnt);
2147 dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, cnt);
2148 spin_unlock(&dq_state_lock);
2132 mutex_unlock(&dqopt->dqonoff_mutex); 2149 mutex_unlock(&dqopt->dqonoff_mutex);
2133 return 0;
2134 }
2135 inode = dqopt->files[type];
2136 dqopt->files[type] = NULL;
2137 spin_lock(&dq_state_lock);
2138 flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
2139 DQUOT_LIMITS_ENABLED, type);
2140 dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type);
2141 spin_unlock(&dq_state_lock);
2142 mutex_unlock(&dqopt->dqonoff_mutex);
2143 2150
2144 flags = dquot_generic_flag(flags, type); 2151 flags = dquot_generic_flag(flags, cnt);
2145 ret = vfs_load_quota_inode(inode, type, dqopt->info[type].dqi_fmt_id, 2152 ret = vfs_load_quota_inode(inode, cnt,
2146 flags); 2153 dqopt->info[cnt].dqi_fmt_id, flags);
2147 iput(inode); 2154 iput(inode);
2155 }
2148 2156
2149 return ret; 2157 return ret;
2150} 2158}
2159EXPORT_SYMBOL(dquot_resume);
2151 2160
2152int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 2161int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
2153 struct path *path) 2162 struct path *path)
@@ -2172,8 +2181,7 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
2172 struct path path; 2181 struct path path;
2173 int error; 2182 int error;
2174 2183
2175 if (remount) 2184 BUG_ON(remount);
2176 return vfs_quota_on_remount(sb, type);
2177 2185
2178 error = kern_path(name, LOOKUP_FOLLOW, &path); 2186 error = kern_path(name, LOOKUP_FOLLOW, &path);
2179 if (!error) { 2187 if (!error) {
@@ -2196,8 +2204,8 @@ int vfs_quota_enable(struct inode *inode, int type, int format_id,
2196 struct quota_info *dqopt = sb_dqopt(sb); 2204 struct quota_info *dqopt = sb_dqopt(sb);
2197 2205
2198 /* Just unsuspend quotas? */ 2206 /* Just unsuspend quotas? */
2199 if (flags & DQUOT_SUSPENDED) 2207 BUG_ON(flags & DQUOT_SUSPENDED);
2200 return vfs_quota_on_remount(sb, type); 2208
2201 if (!flags) 2209 if (!flags)
2202 return 0; 2210 return 0;
2203 /* Just updating flags needed? */ 2211 /* Just updating flags needed? */
@@ -2263,23 +2271,6 @@ out:
2263} 2271}
2264EXPORT_SYMBOL(vfs_quota_on_mount); 2272EXPORT_SYMBOL(vfs_quota_on_mount);
2265 2273
2266/* Wrapper to turn on quotas when remounting rw */
2267int vfs_dq_quota_on_remount(struct super_block *sb)
2268{
2269 int cnt;
2270 int ret = 0, err;
2271
2272 if (!sb->s_qcop || !sb->s_qcop->quota_on)
2273 return -ENOSYS;
2274 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
2275 err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
2276 if (err < 0 && !ret)
2277 ret = err;
2278 }
2279 return ret;
2280}
2281EXPORT_SYMBOL(vfs_dq_quota_on_remount);
2282
2283static inline qsize_t qbtos(qsize_t blocks) 2274static inline qsize_t qbtos(qsize_t blocks)
2284{ 2275{
2285 return blocks << QIF_DQBLKSIZE_BITS; 2276 return blocks << QIF_DQBLKSIZE_BITS;
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 49a8ba02bc17..5dad5a2707bc 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1243,11 +1243,9 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1243 /* it is read-only already */ 1243 /* it is read-only already */
1244 goto out_ok; 1244 goto out_ok;
1245 1245
1246 err = vfs_dq_off(s, 1); 1246 err = dquot_suspend(s, -1);
1247 if (err < 0 && err != -ENOSYS) { 1247 if (err < 0)
1248 err = -EBUSY;
1249 goto out_err; 1248 goto out_err;
1250 }
1251 1249
1252 /* try to remount file system with read-only permissions */ 1250 /* try to remount file system with read-only permissions */
1253 if (sb_umount_state(rs) == REISERFS_VALID_FS 1251 if (sb_umount_state(rs) == REISERFS_VALID_FS
@@ -1302,7 +1300,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
1302 s->s_dirt = 0; 1300 s->s_dirt = 0;
1303 1301
1304 if (!(*mount_flags & MS_RDONLY)) { 1302 if (!(*mount_flags & MS_RDONLY)) {
1305 vfs_dq_quota_on_remount(s); 1303 dquot_resume(s, -1);
1306 finish_unfinished(s); 1304 finish_unfinished(s);
1307 reiserfs_xattr_init(s, *mount_flags); 1305 reiserfs_xattr_init(s, *mount_flags);
1308 } 1306 }
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 9ab4e259404b..b154c41a7a9a 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -590,15 +590,13 @@ static int udf_remount_fs(struct super_block *sb, int *flags, char *options)
590 if (*flags & MS_RDONLY) { 590 if (*flags & MS_RDONLY) {
591 udf_close_lvid(sb); 591 udf_close_lvid(sb);
592 592
593 error = vfs_dq_off(sb, 1); 593 error = dquot_suspend(sb, -1);
594 if (error < 0 && error != -ENOSYS)
595 error = -EBUSY;
596 } else { 594 } else {
597 udf_open_lvid(sb); 595 udf_open_lvid(sb);
598 596
599 /* mark the fs r/w for quota activity */ 597 /* mark the fs r/w for quota activity */
600 sb->s_flags &= ~MS_RDONLY; 598 sb->s_flags &= ~MS_RDONLY;
601 vfs_dq_quota_on_remount(sb); 599 dquot_resume(sb, -1);
602 } 600 }
603 601
604out_unlock: 602out_unlock:
diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index be1f7b05bc28..495fdc1df7eb 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1291,11 +1291,11 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1291 * fs was mouted as rw, remounting ro 1291 * fs was mouted as rw, remounting ro
1292 */ 1292 */
1293 if (*mount_flags & MS_RDONLY) { 1293 if (*mount_flags & MS_RDONLY) {
1294 err = vfs_dq_off(sb, 1); 1294 err = dquot_suspend(sb, -1);
1295 if (err < 0 && err != -ENOSYS) { 1295 if (err < 0) {
1296 unlock_super(sb); 1296 unlock_super(sb);
1297 unlock_kernel(); 1297 unlock_kernel();
1298 return -EBUSY; 1298 return err;
1299 } 1299 }
1300 1300
1301 ufs_put_super_internal(sb); 1301 ufs_put_super_internal(sb);
@@ -1343,7 +1343,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
1343 unlock_super(sb); 1343 unlock_super(sb);
1344 unlock_kernel(); 1344 unlock_kernel();
1345 if (enable_quota) 1345 if (enable_quota)
1346 vfs_dq_quota_on_remount(sb); 1346 dquot_resume(sb, -1);
1347 return 0; 1347 return 0;
1348} 1348}
1349 1349