@@ -1865,7 +1865,7 @@ EXPORT_SYMBOL(dquot_file_open);
18651865/*
18661866 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount)
18671867 */
1868- int vfs_quota_disable (struct super_block * sb , int type , unsigned int flags )
1868+ int dquot_disable (struct super_block * sb , int type , unsigned int flags )
18691869{
18701870 int cnt , ret = 0 ;
18711871 struct quota_info * dqopt = sb_dqopt (sb );
@@ -1995,14 +1995,16 @@ int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags)
19951995 }
19961996 return ret ;
19971997}
1998- EXPORT_SYMBOL (vfs_quota_disable );
1998+ EXPORT_SYMBOL (dquot_disable );
19991999
20002000int vfs_quota_off (struct super_block * sb , int type , int remount )
20012001{
2002- return vfs_quota_disable (sb , type , remount ? DQUOT_SUSPENDED :
2003- (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED ));
2002+ BUG_ON (remount );
2003+ return dquot_disable (sb , type ,
2004+ DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED );
20042005}
20052006EXPORT_SYMBOL (vfs_quota_off );
2007+
20062008/*
20072009 * Turn quotas on on a device
20082010 */
@@ -2120,34 +2122,41 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
21202122}
21212123
21222124/* Reenable quotas on remount RW */
2123- static int vfs_quota_on_remount (struct super_block * sb , int type )
2125+ int dquot_resume (struct super_block * sb , int type )
21242126{
21252127 struct quota_info * dqopt = sb_dqopt (sb );
21262128 struct inode * inode ;
2127- int ret ;
2129+ int ret = 0 , cnt ;
21282130 unsigned int flags ;
21292131
2130- mutex_lock (& dqopt -> dqonoff_mutex );
2131- if (!sb_has_quota_suspended (sb , type )) {
2132+ for (cnt = 0 ; cnt < MAXQUOTAS ; cnt ++ ) {
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 );
21322149 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 );
21432150
2144- flags = dquot_generic_flag (flags , type );
2145- ret = vfs_load_quota_inode (inode , type , dqopt -> info [type ].dqi_fmt_id ,
2146- flags );
2147- iput (inode );
2151+ flags = dquot_generic_flag (flags , cnt );
2152+ ret = vfs_load_quota_inode (inode , cnt ,
2153+ dqopt -> info [cnt ].dqi_fmt_id , flags );
2154+ iput (inode );
2155+ }
21482156
21492157 return ret ;
21502158}
2159+ EXPORT_SYMBOL (dquot_resume );
21512160
21522161int vfs_quota_on_path (struct super_block * sb , int type , int format_id ,
21532162 struct path * path )
@@ -2172,8 +2181,7 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
21722181 struct path path ;
21732182 int error ;
21742183
2175- if (remount )
2176- return vfs_quota_on_remount (sb , type );
2184+ BUG_ON (remount );
21772185
21782186 error = kern_path (name , LOOKUP_FOLLOW , & path );
21792187 if (!error ) {
@@ -2196,8 +2204,8 @@ int vfs_quota_enable(struct inode *inode, int type, int format_id,
21962204 struct quota_info * dqopt = sb_dqopt (sb );
21972205
21982206 /* Just unsuspend quotas? */
2199- if (flags & DQUOT_SUSPENDED )
2200- return vfs_quota_on_remount ( sb , type );
2207+ BUG_ON (flags & DQUOT_SUSPENDED );
2208+
22012209 if (!flags )
22022210 return 0 ;
22032211 /* Just updating flags needed? */
@@ -2263,23 +2271,6 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
22632271}
22642272EXPORT_SYMBOL (vfs_quota_on_mount );
22652273
2266- /* Wrapper to turn on quotas when remounting rw */
2267- int 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- }
2281- EXPORT_SYMBOL (vfs_dq_quota_on_remount );
2282-
22832274static inline qsize_t qbtos (qsize_t blocks )
22842275{
22852276 return blocks << QIF_DQBLKSIZE_BITS ;
0 commit comments