linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Cc: linux-xfs@vger.kernel.org, Ritesh Harjani <ritesh.list@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Darrick J . Wong" <djwong@kernel.org>,
	dchinner@redhat.com, Chandan Babu R <chandan.babu@oracle.com>
Subject: Re: [PATCH] xfs: Check for deallayed allocations before setting extsize
Date: Thu, 3 Oct 2024 07:38:11 -0700	[thread overview]
Message-ID: <Zv6sU5eF4OCPTzNH@infradead.org> (raw)
In-Reply-To: <20241003101207.205083-1-ojaswin@linux.ibm.com>

On Thu, Oct 03, 2024 at 03:42:07PM +0530, Ojaswin Mujoo wrote:
> Extsize is allowed to be set on files with no data in it. For this,
> we were checking if the files have extents but missed to check if
> delayed extents were present. This patch adds that check.
> 
> **Without the patch (SUCCEEDS)**
> 
> $ xfs_io -c 'open -f testfile' -c 'pwrite 0 1024' -c 'extsize 65536'

Can you add a testcase for this to xfstests?

> -	if (S_ISREG(VFS_I(ip)->i_mode) && ip->i_df.if_nextents &&
> +	if (S_ISREG(VFS_I(ip)->i_mode) &&
> +	    (ip->i_df.if_nextents || ip->i_delayed_blks) &&

We have two other copies of the

	ip->i_df.if_nextents || ip->i_delayed_blks

pattern to check if there is any data on the inode in xfs_inactive and
xfs_ioctl_setattr_xflags.  Maybe facto this into a documented helper?

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


  reply	other threads:[~2024-10-03 14:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 10:12 [PATCH] xfs: Check for deallayed allocations before setting extsize Ojaswin Mujoo
2024-10-03 14:38 ` Christoph Hellwig [this message]
2024-10-04  8:56   ` Ojaswin Mujoo
2024-10-04 12:15     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zv6sU5eF4OCPTzNH@infradead.org \
    --to=hch@infradead.org \
    --cc=chandan.babu@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ojaswin@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).