diff mbox series

[7/7] quota: Handle quotas without quota inodes in dquot_get_state()

Message ID 20191104105207.1530-7-jack@suse.cz (mailing list archive)
State New, archived
Headers show
Series quota: Allow quota support without quota files | expand

Commit Message

Jan Kara Nov. 4, 2019, 10:51 a.m. UTC
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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 4c3da4ea31bc..a69a657209a6 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -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);
 	}