]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/dquot.c
tty: Make get_current_tty use a kref
[linux-2.6-omap-h63xx.git] / fs / dquot.c
index 1346eebe74ce973e1b81edd788a58442089329af..7417a6ca3129993b316456acd364e17a1102ee02 100644 (file)
@@ -897,8 +897,9 @@ static void print_warning(struct dquot *dquot, const int warntype)
 
        mutex_lock(&tty_mutex);
        tty = get_current_tty();
+       mutex_unlock(&tty_mutex);
        if (!tty)
-               goto out_lock;
+               return;
        tty_write_message(tty, dquot->dq_sb->s_id);
        if (warntype == QUOTA_NL_ISOFTWARN || warntype == QUOTA_NL_BSOFTWARN)
                tty_write_message(tty, ": warning, ");
@@ -926,8 +927,7 @@ static void print_warning(struct dquot *dquot, const int warntype)
                        break;
        }
        tty_write_message(tty, msg);
-out_lock:
-       mutex_unlock(&tty_mutex);
+       tty_kref_put(tty);
 }
 #endif
 
@@ -1793,6 +1793,21 @@ static int vfs_quota_on_remount(struct super_block *sb, int type)
        return ret;
 }
 
+int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
+                     struct path *path)
+{
+       int error = security_quota_on(path->dentry);
+       if (error)
+               return error;
+       /* Quota file not on the same filesystem? */
+       if (path->mnt->mnt_sb != sb)
+               error = -EXDEV;
+       else
+               error = vfs_quota_on_inode(path->dentry->d_inode, type,
+                                          format_id);
+       return error;
+}
+
 /* Actual function called from quotactl() */
 int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path,
                 int remount)
@@ -1804,19 +1819,10 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path,
                return vfs_quota_on_remount(sb, type);
 
        error = path_lookup(path, LOOKUP_FOLLOW, &nd);
-       if (error < 0)
-               return error;
-       error = security_quota_on(nd.path.dentry);
-       if (error)
-               goto out_path;
-       /* Quota file not on the same filesystem? */
-       if (nd.path.mnt->mnt_sb != sb)
-               error = -EXDEV;
-       else
-               error = vfs_quota_on_inode(nd.path.dentry->d_inode, type,
-                                          format_id);
-out_path:
-       path_put(&nd.path);
+       if (!error) {
+               error = vfs_quota_on_path(sb, type, format_id, &nd.path);
+               path_put(&nd.path);
+       }
        return error;
 }
 
@@ -2185,6 +2191,7 @@ EXPORT_SYMBOL(unregister_quota_format);
 EXPORT_SYMBOL(dqstats);
 EXPORT_SYMBOL(dq_data_lock);
 EXPORT_SYMBOL(vfs_quota_on);
+EXPORT_SYMBOL(vfs_quota_on_path);
 EXPORT_SYMBOL(vfs_quota_on_mount);
 EXPORT_SYMBOL(vfs_quota_off);
 EXPORT_SYMBOL(vfs_quota_sync);