Skip to content

Commit 721068d

Browse files
committed
Merge tag 'gfs2-v6.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 update from Andreas Gruenbacher: - Convert the writepage address space operation to writepages (Matthew Wilcox) - A syzkaller fix (by Julian Sun) and a minor cleanup (Andreas Gruenbacher) * tag 'gfs2-v6.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: Remove gfs2_aspace_writepage() gfs2: Remove gfs2_jdata_writepage() gfs2: Remove __gfs2_writepage() gfs2: Add gfs2_aspace_writepages() gfs2: fix double destroy_workqueue error gfs2: Minor gfs2_glock_cb cleanup
2 parents a1fb2fc + 6888c1e commit 721068d

File tree

5 files changed

+27
-51
lines changed

5 files changed

+27
-51
lines changed

fs/gfs2/aops.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -138,35 +138,6 @@ static int __gfs2_jdata_write_folio(struct folio *folio,
138138
return gfs2_write_jdata_folio(folio, wbc);
139139
}
140140

141-
/**
142-
* gfs2_jdata_writepage - Write complete page
143-
* @page: Page to write
144-
* @wbc: The writeback control
145-
*
146-
* Returns: errno
147-
*
148-
*/
149-
150-
static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc)
151-
{
152-
struct folio *folio = page_folio(page);
153-
struct inode *inode = page->mapping->host;
154-
struct gfs2_inode *ip = GFS2_I(inode);
155-
struct gfs2_sbd *sdp = GFS2_SB(inode);
156-
157-
if (gfs2_assert_withdraw(sdp, ip->i_gl->gl_state == LM_ST_EXCLUSIVE))
158-
goto out;
159-
if (folio_test_checked(folio) || current->journal_info)
160-
goto out_ignore;
161-
return __gfs2_jdata_write_folio(folio, wbc);
162-
163-
out_ignore:
164-
folio_redirty_for_writepage(wbc, folio);
165-
out:
166-
folio_unlock(folio);
167-
return 0;
168-
}
169-
170141
/**
171142
* gfs2_writepages - Write a bunch of dirty pages back to disk
172143
* @mapping: The mapping to write
@@ -748,7 +719,6 @@ static const struct address_space_operations gfs2_aops = {
748719
};
749720

750721
static const struct address_space_operations gfs2_jdata_aops = {
751-
.writepage = gfs2_jdata_writepage,
752722
.writepages = gfs2_jdata_writepages,
753723
.read_folio = gfs2_read_folio,
754724
.readahead = gfs2_readahead,

fs/gfs2/glock.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,14 +1885,16 @@ void gfs2_glock_dq_m(unsigned int num_gh, struct gfs2_holder *ghs)
18851885
void gfs2_glock_cb(struct gfs2_glock *gl, unsigned int state)
18861886
{
18871887
unsigned long delay = 0;
1888-
unsigned long holdtime;
1889-
unsigned long now = jiffies;
18901888

18911889
gfs2_glock_hold(gl);
18921890
spin_lock(&gl->gl_lockref.lock);
1893-
holdtime = gl->gl_tchange + gl->gl_hold_time;
18941891
if (!list_empty(&gl->gl_holders) &&
18951892
gl->gl_name.ln_type == LM_TYPE_INODE) {
1893+
unsigned long now = jiffies;
1894+
unsigned long holdtime;
1895+
1896+
holdtime = gl->gl_tchange + gl->gl_hold_time;
1897+
18961898
if (time_before(now, holdtime))
18971899
delay = holdtime - now;
18981900
if (test_bit(GLF_HAVE_REPLY, &gl->gl_flags))
@@ -2249,6 +2251,7 @@ void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
22492251
gfs2_free_dead_glocks(sdp);
22502252
glock_hash_walk(dump_glock_func, sdp);
22512253
destroy_workqueue(sdp->sd_glock_wq);
2254+
sdp->sd_glock_wq = NULL;
22522255
}
22532256

22542257
static const char *state2str(unsigned state)

fs/gfs2/log.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ void gfs2_remove_from_ail(struct gfs2_bufdata *bd)
8080
brelse(bd->bd_bh);
8181
}
8282

83-
static int __gfs2_writepage(struct folio *folio, struct writeback_control *wbc,
84-
void *data)
85-
{
86-
struct address_space *mapping = data;
87-
int ret = mapping->a_ops->writepage(&folio->page, wbc);
88-
mapping_set_error(mapping, ret);
89-
return ret;
90-
}
91-
9283
/**
9384
* gfs2_ail1_start_one - Start I/O on a transaction
9485
* @sdp: The superblock
@@ -140,7 +131,7 @@ __acquires(&sdp->sd_ail_lock)
140131
if (!mapping)
141132
continue;
142133
spin_unlock(&sdp->sd_ail_lock);
143-
ret = write_cache_pages(mapping, wbc, __gfs2_writepage, mapping);
134+
ret = mapping->a_ops->writepages(mapping, wbc);
144135
if (need_resched()) {
145136
blk_finish_plug(plug);
146137
cond_resched();
@@ -149,6 +140,7 @@ __acquires(&sdp->sd_ail_lock)
149140
spin_lock(&sdp->sd_ail_lock);
150141
if (ret == -ENODATA) /* if a jdata write into a new hole */
151142
ret = 0; /* ignore it */
143+
mapping_set_error(mapping, ret);
152144
if (ret || wbc->nr_to_write <= 0)
153145
break;
154146
return -EBUSY;

fs/gfs2/meta_io.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
#include "util.h"
3131
#include "trace_gfs2.h"
3232

33-
static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wbc)
33+
static void gfs2_aspace_write_folio(struct folio *folio,
34+
struct writeback_control *wbc)
3435
{
35-
struct folio *folio = page_folio(page);
3636
struct buffer_head *bh, *head;
3737
int nr_underway = 0;
3838
blk_opf_t write_flags = REQ_META | REQ_PRIO | wbc_to_write_flags(wbc);
@@ -66,8 +66,8 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
6666
} while ((bh = bh->b_this_page) != head);
6767

6868
/*
69-
* The page and its buffers are protected by PageWriteback(), so we can
70-
* drop the bh refcounts early.
69+
* The folio and its buffers are protected from truncation by
70+
* the writeback flag, so we can drop the bh refcounts early.
7171
*/
7272
BUG_ON(folio_test_writeback(folio));
7373
folio_start_writeback(folio);
@@ -84,21 +84,31 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
8484

8585
if (nr_underway == 0)
8686
folio_end_writeback(folio);
87+
}
8788

88-
return 0;
89+
static int gfs2_aspace_writepages(struct address_space *mapping,
90+
struct writeback_control *wbc)
91+
{
92+
struct folio *folio = NULL;
93+
int error;
94+
95+
while ((folio = writeback_iter(mapping, wbc, folio, &error)))
96+
gfs2_aspace_write_folio(folio, wbc);
97+
98+
return error;
8999
}
90100

91101
const struct address_space_operations gfs2_meta_aops = {
92102
.dirty_folio = block_dirty_folio,
93103
.invalidate_folio = block_invalidate_folio,
94-
.writepage = gfs2_aspace_writepage,
104+
.writepages = gfs2_aspace_writepages,
95105
.release_folio = gfs2_release_folio,
96106
};
97107

98108
const struct address_space_operations gfs2_rgrp_aops = {
99109
.dirty_folio = block_dirty_folio,
100110
.invalidate_folio = block_invalidate_folio,
101-
.writepage = gfs2_aspace_writepage,
111+
.writepages = gfs2_aspace_writepages,
102112
.release_folio = gfs2_release_folio,
103113
};
104114

fs/gfs2/ops_fstype.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1307,7 +1307,8 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
13071307
fail_delete_wq:
13081308
destroy_workqueue(sdp->sd_delete_wq);
13091309
fail_glock_wq:
1310-
destroy_workqueue(sdp->sd_glock_wq);
1310+
if (sdp->sd_glock_wq)
1311+
destroy_workqueue(sdp->sd_glock_wq);
13111312
fail_free:
13121313
free_sbd(sdp);
13131314
sb->s_fs_info = NULL;

0 commit comments

Comments
 (0)