diff mbox

[10/27] quota: Remove locking for writing to the old quota format

Message ID 20170816154127.7048-11-jack@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kara Aug. 16, 2017, 3:41 p.m. UTC
The old quota quota format has fixed offset in quota file based on ID so
there's no locking needed against concurrent modifications of the file
(locking against concurrent IO on the same dquot is still provided by
dq_lock).

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota_v1.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Andreas Dilger Aug. 16, 2017, 4:50 p.m. UTC | #1
On Aug 16, 2017, at 9:41 AM, Jan Kara <jack@suse.cz> wrote:
> 
> The old quota quota format has fixed offset in quota file based on ID so
> there's no locking needed against concurrent modifications of the file
> (locking against concurrent IO on the same dquot is still provided by
> dq_lock).
> 
> Signed-off-by: Jan Kara <jack@suse.cz>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/quota/quota_v1.c | 3 ---
> 1 file changed, 3 deletions(-)
> 
> diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
> index 94cceb76b9a3..12d69cda57cc 100644
> --- a/fs/quota/quota_v1.c
> +++ b/fs/quota/quota_v1.c
> @@ -83,9 +83,7 @@ static int v1_commit_dqblk(struct dquot *dquot)
> 	short type = dquot->dq_id.type;
> 	ssize_t ret;
> 	struct v1_disk_dqblk dqblk;
> -	struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
> 
> -	down_write(&dqopt->dqio_sem);
> 	v1_mem2disk_dqblk(&dqblk, &dquot->dq_dqb);
> 	if (((type == USRQUOTA) && uid_eq(dquot->dq_id.uid, GLOBAL_ROOT_UID)) ||
> 	    ((type == GRPQUOTA) && gid_eq(dquot->dq_id.gid, GLOBAL_ROOT_GID))) {
> @@ -99,7 +97,6 @@ static int v1_commit_dqblk(struct dquot *dquot)
> 		ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type,
> 			(char *)&dqblk, sizeof(struct v1_disk_dqblk),
> 			v1_dqoff(from_kqid(&init_user_ns, dquot->dq_id)));
> -	up_write(&dqopt->dqio_sem);
> 	if (ret != sizeof(struct v1_disk_dqblk)) {
> 		quota_error(dquot->dq_sb, "dquota write failed");
> 		if (ret >= 0)
> --
> 2.12.3
> 


Cheers, Andreas
diff mbox

Patch

diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index 94cceb76b9a3..12d69cda57cc 100644
--- a/fs/quota/quota_v1.c
+++ b/fs/quota/quota_v1.c
@@ -83,9 +83,7 @@  static int v1_commit_dqblk(struct dquot *dquot)
 	short type = dquot->dq_id.type;
 	ssize_t ret;
 	struct v1_disk_dqblk dqblk;
-	struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
 
-	down_write(&dqopt->dqio_sem);
 	v1_mem2disk_dqblk(&dqblk, &dquot->dq_dqb);
 	if (((type == USRQUOTA) && uid_eq(dquot->dq_id.uid, GLOBAL_ROOT_UID)) ||
 	    ((type == GRPQUOTA) && gid_eq(dquot->dq_id.gid, GLOBAL_ROOT_GID))) {
@@ -99,7 +97,6 @@  static int v1_commit_dqblk(struct dquot *dquot)
 		ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type,
 			(char *)&dqblk, sizeof(struct v1_disk_dqblk),
 			v1_dqoff(from_kqid(&init_user_ns, dquot->dq_id)));
-	up_write(&dqopt->dqio_sem);
 	if (ret != sizeof(struct v1_disk_dqblk)) {
 		quota_error(dquot->dq_sb, "dquota write failed");
 		if (ret >= 0)