Skip to content

Commit

Permalink
quota: use lockdep_assert_held_write in dquot_load_quota_sb
Browse files Browse the repository at this point in the history
Use lockdep_assert_held_write to assert and self-document the locking
state in dquot_load_quota_sb instead of hand-crafting it with a trylock.

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Message-Id: <[email protected]>
  • Loading branch information
Christoph Hellwig authored and jankara committed Aug 3, 2023
1 parent 2363650 commit 7a64774
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2365,11 +2365,10 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
struct quota_info *dqopt = sb_dqopt(sb);
int error;

lockdep_assert_held_write(&sb->s_umount);

/* Just unsuspend quotas? */
BUG_ON(flags & DQUOT_SUSPENDED);
/* s_umount should be held in exclusive mode */
if (WARN_ON_ONCE(down_read_trylock(&sb->s_umount)))
up_read(&sb->s_umount);

if (!fmt)
return -ESRCH;
Expand Down

0 comments on commit 7a64774

Please sign in to comment.