]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/dquot.c
[PATCH] tty: ->signal->tty locking
[net-next-2.6.git] / fs / dquot.c
index f9cd5e23ebdf2aaa9e91ca71e3cda95dbe60560a..89066b19124d4ee4db28019d58523fb9a4c597d2 100644 (file)
@@ -828,6 +828,7 @@ static inline int need_print_warning(struct dquot *dquot)
 static void print_warning(struct dquot *dquot, const char warntype)
 {
        char *msg = NULL;
+       struct tty_struct *tty;
        int flag = (warntype == BHARDWARN || warntype == BSOFTLONGWARN) ? DQ_BLKS_B :
          ((warntype == IHARDWARN || warntype == ISOFTLONGWARN) ? DQ_INODES_B : 0);
 
@@ -835,14 +836,15 @@ static void print_warning(struct dquot *dquot, const char warntype)
                return;
 
        mutex_lock(&tty_mutex);
-       if (!current->signal->tty)
+       tty = get_current_tty();
+       if (!tty)
                goto out_lock;
-       tty_write_message(current->signal->tty, dquot->dq_sb->s_id);
+       tty_write_message(tty, dquot->dq_sb->s_id);
        if (warntype == ISOFTWARN || warntype == BSOFTWARN)
-               tty_write_message(current->signal->tty, ": warning, ");
+               tty_write_message(tty, ": warning, ");
        else
-               tty_write_message(current->signal->tty, ": write failed, ");
-       tty_write_message(current->signal->tty, quotatypes[dquot->dq_type]);
+               tty_write_message(tty, ": write failed, ");
+       tty_write_message(tty, quotatypes[dquot->dq_type]);
        switch (warntype) {
                case IHARDWARN:
                        msg = " file limit reached.\r\n";
@@ -863,7 +865,7 @@ static void print_warning(struct dquot *dquot, const char warntype)
                        msg = " block quota exceeded.\r\n";
                        break;
        }
-       tty_write_message(current->signal->tty, msg);
+       tty_write_message(tty, msg);
 out_lock:
        mutex_unlock(&tty_mutex);
 }