quota: Handle quotas without quota inodes in dquot_get_state()
authorJan Kara <jack@suse.cz>
Mon, 4 Nov 2019 10:18:17 +0000 (11:18 +0100)
committerJan Kara <jack@suse.cz>
Mon, 4 Nov 2019 10:21:40 +0000 (11:21 +0100)
Make dquot_get_state() gracefully handle a situation when there are no
quota files present even though quotas are enabled.

Signed-off-by: Jan Kara <jack@suse.cz>
fs/quota/dquot.c

index 4c3da4e..a69a657 100644 (file)
@@ -2787,8 +2787,10 @@ int dquot_get_state(struct super_block *sb, struct qc_state *state)
                        tstate->flags |= QCI_LIMITS_ENFORCED;
                tstate->spc_timelimit = mi->dqi_bgrace;
                tstate->ino_timelimit = mi->dqi_igrace;
-               tstate->ino = dqopt->files[type]->i_ino;
-               tstate->blocks = dqopt->files[type]->i_blocks;
+               if (dqopt->files[type]) {
+                       tstate->ino = dqopt->files[type]->i_ino;
+                       tstate->blocks = dqopt->files[type]->i_blocks;
+               }
                tstate->nextents = 1;   /* We don't know... */
                spin_unlock(&dq_data_lock);
        }