Commit 8fdabcd9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull gfs2 updates from Andreas Gruenbacher:

 - Fix the long-standing warnings in inode_to_wb() when CONFIG_LOCKDEP
   is enabled: gfs2 doesn't support cgroup writeback and so inode->i_wb
   will never change. This is the counterpart of commit 9e888998
   ("writeback: fix false warning in inode_to_wb()")

 - Fix a hang introduced by commit 8d391972 ("gfs2: Remove
   __gfs2_writepage()"): prevent gfs2_logd from creating transactions
   for jdata pages while trying to flush the log

 - Fix a race between gfs2_create_inode() and gfs2_evict_inode() by
   deallocating partially created inodes on the gfs2_create_inode()
   error path

 - Fix a bug in the journal head lookup code that could cause mount to
   fail after successful recovery

 - Various smaller fixes and cleanups from various people

* tag 'gfs2-for-6.16' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: (23 commits)
  gfs2: No more gfs2_find_jhead caching
  gfs2: Get rid of duplicate log head lookup
  gfs2: Simplify clean_journal
  gfs2: Simplify gfs2_log_pointers_init
  gfs2: Move gfs2_log_pointers_init
  gfs2: Minor comments fix
  gfs2: Don't start unnecessary transactions during log flush
  gfs2: Move gfs2_trans_add_databufs
  gfs2: Rename jdata_dirty_folio to gfs2_jdata_dirty_folio
  gfs2: avoid inefficient use of crc32_le_shift()
  gfs2: Do not call iomap_zero_range beyond eof
  gfs: don't check for AOP_WRITEPAGE_ACTIVATE in gfs2_write_jdata_batch
  gfs2: Fix usage of bio->bi_status in gfs2_end_log_write
  gfs2: deallocate inodes in gfs2_create_inode
  gfs2: Move GIF_ALLOC_FAILED check out of gfs2_ea_dealloc
  gfs2: Move gfs2_dinode_dealloc
  gfs2: Don't reread inodes unnecessarily
  gfs2: gfs2_create_inode error handling fix
  gfs2: Remove unnecessary NULL check before free_percpu()
  gfs2: check sb_min_blocksize return value
  ...
parents a56d3133 e320050e
Loading
Loading
Loading
Loading
+44 −42
Original line number Diff line number Diff line
@@ -37,27 +37,6 @@
#include "aops.h"


void gfs2_trans_add_databufs(struct gfs2_inode *ip, struct folio *folio,
			     size_t from, size_t len)
{
	struct buffer_head *head = folio_buffers(folio);
	unsigned int bsize = head->b_size;
	struct buffer_head *bh;
	size_t to = from + len;
	size_t start, end;

	for (bh = head, start = 0; bh != head || !start;
	     bh = bh->b_this_page, start = end) {
		end = start + bsize;
		if (end <= from)
			continue;
		if (start >= to)
			break;
		set_buffer_uptodate(bh);
		gfs2_trans_add_data(ip->i_gl, bh);
	}
}

/**
 * gfs2_get_block_noalloc - Fills in a buffer head with details about a block
 * @inode: The inode
@@ -133,11 +112,42 @@ static int __gfs2_jdata_write_folio(struct folio *folio,
					inode->i_sb->s_blocksize,
					BIT(BH_Dirty)|BIT(BH_Uptodate));
		}
		gfs2_trans_add_databufs(ip, folio, 0, folio_size(folio));
		gfs2_trans_add_databufs(ip->i_gl, folio, 0, folio_size(folio));
	}
	return gfs2_write_jdata_folio(folio, wbc);
}

/**
 * gfs2_jdata_writeback - Write jdata folios to the log
 * @mapping: The mapping to write
 * @wbc: The writeback control
 *
 * Returns: errno
 */
int gfs2_jdata_writeback(struct address_space *mapping, struct writeback_control *wbc)
{
	struct inode *inode = mapping->host;
	struct gfs2_inode *ip = GFS2_I(inode);
	struct gfs2_sbd *sdp = GFS2_SB(mapping->host);
	struct folio *folio = NULL;
	int error;

	BUG_ON(current->journal_info);
	if (gfs2_assert_withdraw(sdp, ip->i_gl->gl_state == LM_ST_EXCLUSIVE))
		return 0;

	while ((folio = writeback_iter(mapping, wbc, folio, &error))) {
		if (folio_test_checked(folio)) {
			folio_redirty_for_writepage(wbc, folio);
			folio_unlock(folio);
			continue;
		}
		error = __gfs2_jdata_write_folio(folio, wbc);
	}

	return error;
}

/**
 * gfs2_writepages - Write a bunch of dirty pages back to disk
 * @mapping: The mapping to write
@@ -228,25 +238,17 @@ static int gfs2_write_jdata_batch(struct address_space *mapping,

		ret = __gfs2_jdata_write_folio(folio, wbc);
		if (unlikely(ret)) {
			if (ret == AOP_WRITEPAGE_ACTIVATE) {
				folio_unlock(folio);
				ret = 0;
			} else {

			/*
				 * done_index is set past this page,
				 * so media errors will not choke
				 * background writeout for the entire
				 * file. This has consequences for
				 * range_cyclic semantics (ie. it may
				 * not be suitable for data integrity
				 * writeout).
			 * done_index is set past this page, so media errors
			 * will not choke background writeout for the entire
			 * file. This has consequences for range_cyclic
			 * semantics (ie. it may not be suitable for data
			 * integrity writeout).
			 */
			*done_index = folio_next_index(folio);
			ret = 1;
			break;
		}
		}

		/*
		 * We stop writing back only if we are not doing
@@ -540,7 +542,7 @@ void adjust_fs_space(struct inode *inode)
	gfs2_trans_end(sdp);
}

static bool jdata_dirty_folio(struct address_space *mapping,
static bool gfs2_jdata_dirty_folio(struct address_space *mapping,
		struct folio *folio)
{
	if (current->journal_info)
@@ -722,7 +724,7 @@ static const struct address_space_operations gfs2_jdata_aops = {
	.writepages = gfs2_jdata_writepages,
	.read_folio = gfs2_read_folio,
	.readahead = gfs2_readahead,
	.dirty_folio = jdata_dirty_folio,
	.dirty_folio = gfs2_jdata_dirty_folio,
	.bmap = gfs2_bmap,
	.migrate_folio = buffer_migrate_folio,
	.invalidate_folio = gfs2_invalidate_folio,
+1 −2
Original line number Diff line number Diff line
@@ -9,7 +9,6 @@
#include "incore.h"

void adjust_fs_space(struct inode *inode);
void gfs2_trans_add_databufs(struct gfs2_inode *ip, struct folio *folio,
			     size_t from, size_t len);
int gfs2_jdata_writeback(struct address_space *mapping, struct writeback_control *wbc);

#endif /* __AOPS_DOT_H__ */
+6 −3
Original line number Diff line number Diff line
@@ -988,7 +988,8 @@ static void gfs2_iomap_put_folio(struct inode *inode, loff_t pos,
	struct gfs2_sbd *sdp = GFS2_SB(inode);

	if (!gfs2_is_stuffed(ip))
		gfs2_trans_add_databufs(ip, folio, offset_in_folio(folio, pos),
		gfs2_trans_add_databufs(ip->i_gl, folio,
					offset_in_folio(folio, pos),
					copied);

	folio_unlock(folio);
@@ -1296,10 +1297,12 @@ int gfs2_alloc_extent(struct inode *inode, u64 lblock, u64 *dblock,
 * uses iomap write to perform its actions, which begin their own transactions
 * (iomap_begin, get_folio, etc.)
 */
static int gfs2_block_zero_range(struct inode *inode, loff_t from,
				 unsigned int length)
static int gfs2_block_zero_range(struct inode *inode, loff_t from, loff_t length)
{
	BUG_ON(current->journal_info);
	if (from >= inode->i_size)
		return 0;
	length = min(length, inode->i_size - from);
	return iomap_zero_range(inode, from, length, NULL, &gfs2_iomap_ops,
			NULL);
}
+1 −2
Original line number Diff line number Diff line
@@ -1166,7 +1166,6 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
		   const struct gfs2_glock_operations *glops, int create,
		   struct gfs2_glock **glp)
{
	struct super_block *s = sdp->sd_vfs;
	struct lm_lockname name = { .ln_number = number,
				    .ln_type = glops->go_type,
				    .ln_sbd = sdp };
@@ -1229,7 +1228,7 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
	mapping = gfs2_glock2aspace(gl);
	if (mapping) {
                mapping->a_ops = &gfs2_meta_aops;
		mapping->host = s->s_bdev->bd_mapping->host;
		mapping->host = sdp->sd_inode;
		mapping->flags = 0;
		mapping_set_gfp_mask(mapping, GFP_NOFS);
		mapping->i_private_data = NULL;
+4 −5
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
static int gfs2_rgrp_metasync(struct gfs2_glock *gl)
{
	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
	struct address_space *metamapping = &sdp->sd_aspace;
	struct address_space *metamapping = gfs2_aspace(sdp);
	struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
	const unsigned bsize = sdp->sd_sb.sb_bsize;
	loff_t start = (rgd->rd_addr * bsize) & PAGE_MASK;
@@ -225,7 +225,7 @@ static int rgrp_go_sync(struct gfs2_glock *gl)
static void rgrp_go_inval(struct gfs2_glock *gl, int flags)
{
	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
	struct address_space *mapping = &sdp->sd_aspace;
	struct address_space *mapping = gfs2_aspace(sdp);
	struct gfs2_rgrpd *rgd = gfs2_glock2rgrp(gl);
	const unsigned bsize = sdp->sd_sb.sb_bsize;
	loff_t start, end;
@@ -601,14 +601,13 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl)
	if (test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) {
		j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);

		error = gfs2_find_jhead(sdp->sd_jdesc, &head, false);
		error = gfs2_find_jhead(sdp->sd_jdesc, &head);
		if (gfs2_assert_withdraw_delayed(sdp, !error))
			return error;
		if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags &
						 GFS2_LOG_HEAD_UNMOUNT))
			return -EIO;
		sdp->sd_log_sequence = head.lh_sequence + 1;
		gfs2_log_pointers_init(sdp, head.lh_blkno);
		gfs2_log_pointers_init(sdp, &head);
	}
	return 0;
}
Loading