Skip to content

Commit 1b50259

Browse files
committed
[GFS2] Drop log lock on I/O error & tidy up
This patch drops the log spinlock when an I/O error occurs to avoid any possible problems in case of blocking or recursion in the I/O error routine. It also has a few cosmetic changes to tidy up various other files. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent 02f211f commit 1b50259

4 files changed

Lines changed: 17 additions & 16 deletions

File tree

‎fs/gfs2/meta_io.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
226226
gfs2_assert(sdp, bd->bd_ail == ai);
227227

228228
if (!buffer_busy(bh)) {
229-
if (!buffer_uptodate(bh))
229+
if (!buffer_uptodate(bh)) {
230+
gfs2_log_unlock(sdp);
230231
gfs2_io_error_bh(sdp, bh);
232+
gfs2_log_lock(sdp);
233+
}
231234
list_move(&bd->bd_ail_st_list,
232235
&ai->ai_ail2_list);
233236
continue;

‎fs/gfs2/ops_inode.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
213213
if (error)
214214
goto out_gunlock_q;
215215

216-
error = gfs2_trans_begin(sdp,
217-
sdp->sd_max_dirres +
216+
error = gfs2_trans_begin(sdp, sdp->sd_max_dirres +
218217
al->al_rgd->rd_ri.ri_length +
219218
2 * RES_DINODE + RES_STATFS +
220219
RES_QUOTA, 0);
@@ -303,7 +302,7 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
303302
if (error)
304303
goto out_gunlock;
305304

306-
error = gfs2_unlinki(dip, &dentry->d_name, ip,ul);
305+
error = gfs2_unlinki(dip, &dentry->d_name, ip, ul);
307306

308307
gfs2_trans_end(sdp);
309308

‎fs/gfs2/page.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,9 @@ int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
155155
if (!PageUptodate(page)) {
156156
void *kaddr = kmap(page);
157157

158-
memcpy(kaddr,
159-
dibh->b_data + sizeof(struct gfs2_dinode),
158+
memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
160159
ip->i_di.di_size);
161-
memset(kaddr + ip->i_di.di_size,
162-
0,
160+
memset(kaddr + ip->i_di.di_size, 0,
163161
PAGE_CACHE_SIZE - ip->i_di.di_size);
164162
kunmap(page);
165163

‎fs/gfs2/unlinked.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,12 @@ static void enforce_limit(struct gfs2_sbd *sdp)
130130
unsigned int tries = 0, min = 0;
131131
int error;
132132

133-
if (atomic_read(&sdp->sd_unlinked_count) >=
134-
gfs2_tune_get(sdp, gt_ilimit)) {
135-
tries = gfs2_tune_get(sdp, gt_ilimit_tries);
136-
min = gfs2_tune_get(sdp, gt_ilimit_min);
137-
}
133+
if (atomic_read(&sdp->sd_unlinked_count) <
134+
gfs2_tune_get(sdp, gt_ilimit))
135+
return;
136+
137+
tries = gfs2_tune_get(sdp, gt_ilimit_tries);
138+
min = gfs2_tune_get(sdp, gt_ilimit_min);
138139

139140
while (tries--) {
140141
struct gfs2_unlinked *ul = ul_fish(sdp);
@@ -187,7 +188,7 @@ int gfs2_unlinked_get(struct gfs2_sbd *sdp, struct gfs2_unlinked **ul)
187188

188189
goto fail;
189190

190-
found:
191+
found:
191192
for (b = 0; b < 8; b++)
192193
if (!(byte & (1 << b)))
193194
break;
@@ -202,7 +203,7 @@ int gfs2_unlinked_get(struct gfs2_sbd *sdp, struct gfs2_unlinked **ul)
202203

203204
return 0;
204205

205-
fail:
206+
fail:
206207
spin_unlock(&sdp->sd_unlinked_spin);
207208
kfree(*ul);
208209
return -ENOSPC;
@@ -410,7 +411,7 @@ int gfs2_unlinked_init(struct gfs2_sbd *sdp)
410411

411412
return 0;
412413

413-
fail:
414+
fail:
414415
gfs2_unlinked_cleanup(sdp);
415416
return error;
416417
}

0 commit comments

Comments
 (0)