From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Fri, 3 Jan 2020 09:31:19 -0600 Subject: [Cluster-devel] [GFS2 PATCH 2/6] gfs2: revoke cleanup: alloc_dinode and gfs2_create_inode In-Reply-To: <20200103153123.402971-1-rpeterso@redhat.com> References: <20200103153123.402971-1-rpeterso@redhat.com> Message-ID: <20200103153123.402971-3-rpeterso@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Several gfs2 functions failed to reserve enough revoke entries for their transactions in the journal. Function gfs2_trans_remove_revoke unconditionally decrements tr->tr_num_revoke, and if not enough revokes are reserved, the value goes from 0 to 4294967295 (-1, but it's an unsigned int). This is later re-added to the system-wide revoke numbers, thereby decrementing the value (sd_log_commited_revoke) "properly," but by accident. This worked properly most of the time because one transaction would reserve space for revokes, then it would be merged with the system transaction (sdp->sd_log_tr) and it usually did not run out, because you can hold a lot of revoke entries per log descriptor block. Some of the code, such as gfs2_write_revokes, would work around this and somehow got it right most of the time. However, some jdata tests with xfstests generic/269 encountered problems when it actually ran out. This patch is part of a series that tries to do proper accounting of revokes. This patch adds the needed revoke entries to functions alloc_dinode and gfs2_create_inode. Signed-off-by: Bob Peterson --- fs/gfs2/inode.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index dafef10b91f1..eb0989ff1c6f 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -383,7 +383,8 @@ static int alloc_dinode(struct gfs2_inode *ip, u32 flags, unsigned *dblocks) if (error) goto out_quota; - error = gfs2_trans_begin(sdp, (*dblocks * RES_RG_BIT) + RES_STATFS + RES_QUOTA, 0); + error = gfs2_trans_begin(sdp, (*dblocks * RES_RG_BIT) + RES_STATFS + + RES_QUOTA, *dblocks); if (error) goto out_ipreserv; @@ -709,7 +710,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, if (error) goto fail_free_inode; - error = gfs2_trans_begin(sdp, blocks, 0); + error = gfs2_trans_begin(sdp, blocks, RES_DINODE); if (error) goto fail_free_inode; -- 2.24.1