* [Cluster-devel] [PATCH AUTOSEL 4.19 09/19] gfs2: move privileged user check to gfs2_quota_lock_check
[not found] <20200522145120.434921-1-sashal@kernel.org>
@ 2020-05-22 14:51 ` Sasha Levin
2020-05-22 14:51 ` [Cluster-devel] [PATCH AUTOSEL 4.19 10/19] gfs2: don't call quota_unhold if quotas are not locked Sasha Levin
2020-05-22 14:51 ` [Cluster-devel] [PATCH AUTOSEL 4.19 11/19] Revert "gfs2: Don't demote a glock until its revokes are written" Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2020-05-22 14:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Bob Peterson <rpeterso@redhat.com>
[ Upstream commit 4ed0c30811cb4d30ef89850b787a53a84d5d2bcb ]
Before this patch, function gfs2_quota_lock checked if it was called
from a privileged user, and if so, it bypassed the quota check:
superuser can operate outside the quotas.
That's the wrong place for the check because the lock/unlock functions
are separate from the lock_check function, and you can do lock and
unlock without actually checking the quotas.
This patch moves the check to gfs2_quota_lock_check.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/gfs2/quota.c | 3 +--
fs/gfs2/quota.h | 3 ++-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 0efae7a0ee80..dd0f9bc13164 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1043,8 +1043,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
u32 x;
int error = 0;
- if (capable(CAP_SYS_RESOURCE) ||
- sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
+ if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
return 0;
error = gfs2_quota_hold(ip, uid, gid);
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 836f29480be6..e3a6e2404d11 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -47,7 +47,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
int ret;
ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
- if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
+ if (capable(CAP_SYS_RESOURCE) ||
+ sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
return 0;
ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
if (ret)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH AUTOSEL 4.19 10/19] gfs2: don't call quota_unhold if quotas are not locked
[not found] <20200522145120.434921-1-sashal@kernel.org>
2020-05-22 14:51 ` [Cluster-devel] [PATCH AUTOSEL 4.19 09/19] gfs2: move privileged user check to gfs2_quota_lock_check Sasha Levin
@ 2020-05-22 14:51 ` Sasha Levin
2020-05-31 21:22 ` Pavel Machek
2020-05-22 14:51 ` [Cluster-devel] [PATCH AUTOSEL 4.19 11/19] Revert "gfs2: Don't demote a glock until its revokes are written" Sasha Levin
2 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2020-05-22 14:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Bob Peterson <rpeterso@redhat.com>
[ Upstream commit c9cb9e381985bbbe8acd2695bbe6bd24bf06b81c ]
Before this patch, function gfs2_quota_unlock checked if quotas are
turned off, and if so, it branched to label out, which called
gfs2_quota_unhold. With the new system of gfs2_qa_get and put, we
no longer want to call gfs2_quota_unhold or we won't balance our
gets and puts.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/gfs2/quota.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index dd0f9bc13164..ce47c8233612 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1116,7 +1116,7 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
int found;
if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags))
- goto out;
+ return;
for (x = 0; x < ip->i_qadata->qa_qd_num; x++) {
struct gfs2_quota_data *qd;
@@ -1153,7 +1153,6 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
qd_unlock(qda[x]);
}
-out:
gfs2_quota_unhold(ip);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH AUTOSEL 4.19 10/19] gfs2: don't call quota_unhold if quotas are not locked
2020-05-22 14:51 ` [Cluster-devel] [PATCH AUTOSEL 4.19 10/19] gfs2: don't call quota_unhold if quotas are not locked Sasha Levin
@ 2020-05-31 21:22 ` Pavel Machek
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2020-05-31 21:22 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi!
> [ Upstream commit c9cb9e381985bbbe8acd2695bbe6bd24bf06b81c ]
>
> Before this patch, function gfs2_quota_unlock checked if quotas are
> turned off, and if so, it branched to label out, which called
> gfs2_quota_unhold. With the new system of gfs2_qa_get and put, we
> no longer want to call gfs2_quota_unhold or we won't balance our
> gets and puts.
4.19 does not yet contain gfw2_qa_get; according to the changelog that
means that this patch is not suitable for 4.19 kernel.
Best regards,
Pavel
> index dd0f9bc13164..ce47c8233612 100644
> --- a/fs/gfs2/quota.c
> +++ b/fs/gfs2/quota.c
> @@ -1116,7 +1116,7 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
> int found;
>
> if (!test_and_clear_bit(GIF_QD_LOCKED, &ip->i_flags))
> - goto out;
> + return;
>
> for (x = 0; x < ip->i_qadata->qa_qd_num; x++) {
> struct gfs2_quota_data *qd;
> @@ -1153,7 +1153,6 @@ void gfs2_quota_unlock(struct gfs2_inode *ip)
> qd_unlock(qda[x]);
> }
>
> -out:
> gfs2_quota_unhold(ip);
> }
>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20200531/d3a4b2d7/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH AUTOSEL 4.19 11/19] Revert "gfs2: Don't demote a glock until its revokes are written"
[not found] <20200522145120.434921-1-sashal@kernel.org>
2020-05-22 14:51 ` [Cluster-devel] [PATCH AUTOSEL 4.19 09/19] gfs2: move privileged user check to gfs2_quota_lock_check Sasha Levin
2020-05-22 14:51 ` [Cluster-devel] [PATCH AUTOSEL 4.19 10/19] gfs2: don't call quota_unhold if quotas are not locked Sasha Levin
@ 2020-05-22 14:51 ` Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2020-05-22 14:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
From: Bob Peterson <rpeterso@redhat.com>
[ Upstream commit b14c94908b1b884276a6608dea3d0b1b510338b7 ]
This reverts commit df5db5f9ee112e76b5202fbc331f990a0fc316d6.
This patch fixes a regression: patch df5db5f9ee112 allowed function
run_queue() to bypass its call to do_xmote() if revokes were queued for
the glock. That's wrong because its call to do_xmote() is what is
responsible for calling the go_sync() glops functions to sync both
the ail list and any revokes queued for it. By bypassing the call,
gfs2 could get into a stand-off where the glock could not be demoted
until its revokes are written back, but the revokes would not be
written back because do_xmote() was never called.
It "sort of" works, however, because there are other mechanisms like
the log flush daemon (logd) that can sync the ail items and revokes,
if it deems it necessary. The problem is: without file system pressure,
it might never deem it necessary.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/gfs2/glock.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index f8a5eef3d014..ccdd8c821abd 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -636,9 +636,6 @@ __acquires(&gl->gl_lockref.lock)
goto out_unlock;
if (nonblock)
goto out_sched;
- smp_mb();
- if (atomic_read(&gl->gl_revokes) != 0)
- goto out_sched;
set_bit(GLF_DEMOTE_IN_PROGRESS, &gl->gl_flags);
GLOCK_BUG_ON(gl, gl->gl_demote_state == LM_ST_EXCLUSIVE);
gl->gl_target = gl->gl_demote_state;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread