All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ritesh Harjani <riteshh@linux.ibm.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.com>,
	tytso@mit.edu, "Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/2] iomap: bmap: Remove the WARN and return the proper block address
Date: Sat, 25 Apr 2020 04:09:14 +0530	[thread overview]
Message-ID: <20200424223915.D5EB74C059@d06av22.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <20200424174815.GF6733@magnolia>



On 4/24/20 11:18 PM, Darrick J. Wong wrote:
> On Fri, Apr 24, 2020 at 12:52:18PM +0530, Ritesh Harjani wrote:
>> iomap_bmap() could be called from either of these two paths.
>> Either when a user is calling an ioctl_fibmap() interface to get
>> the block mapping address or by some filesystem via use of bmap()
>> internal kernel API.
>> bmap() kernel API is well equipped with handling of u64 addresses.
>>
>> WARN condition in iomap_bmap_actor() was mainly added to warn all
>> the fibmap users. But now that in previous patch we have directly added
>> this WARN condition for all fibmap users and also made sure to return 0
>> as block map address in case if addr > INT_MAX.
>> So we can now remove this logic from here.
>>
>> Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
>> ---
>>   fs/iomap/fiemap.c | 5 +----
>>   1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/fs/iomap/fiemap.c b/fs/iomap/fiemap.c
>> index bccf305ea9ce..d55e8f491a5e 100644
>> --- a/fs/iomap/fiemap.c
>> +++ b/fs/iomap/fiemap.c
>> @@ -117,10 +117,7 @@ iomap_bmap_actor(struct inode *inode, loff_t pos, loff_t length,
>>   
>>   	if (iomap->type == IOMAP_MAPPED) {
>>   		addr = (pos - iomap->offset + iomap->addr) >> inode->i_blkbits;
>> -		if (addr > INT_MAX)
>> -			WARN(1, "would truncate bmap result\n");
> 
> Frankly I would've combined these two patches to make it more obvious
> that we're hoisting a FIBMAP constraint check from iomap into the ioctl
> handler.

Sure, let me combine the two in v2.

Thanks!!
-ritesh

> 
> --D
> 
>> -		else
>> -			*bno = addr;
>> +		*bno = addr;
>>   	}
>>   	return 0;
>>   }
>> -- 
>> 2.21.0
>>

      reply	other threads:[~2020-04-24 22:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24  7:22 [PATCH 0/2] WARN fibmap user in case of possible addr truncation Ritesh Harjani
2020-04-24  7:22 ` [PATCH 1/2] fibmap: Warn and return an error in case of block > INT_MAX Ritesh Harjani
2020-04-24  9:57   ` Jan Kara
2020-04-24 10:07   ` Christoph Hellwig
2020-04-24 19:17   ` Eric Biggers
2020-04-24 22:54     ` Ritesh Harjani
2020-04-24 23:40       ` Matthew Wilcox
2020-04-24 23:46         ` Darrick J. Wong
2020-04-25  7:03           ` Ritesh Harjani
2020-04-27  1:04             ` Dave Chinner
2020-04-28  7:29               ` Ritesh Harjani
2020-04-24  7:22 ` [PATCH 2/2] iomap: bmap: Remove the WARN and return the proper block address Ritesh Harjani
2020-04-24  9:59   ` Jan Kara
2020-04-24 10:07   ` Christoph Hellwig
2020-04-24 17:48   ` Darrick J. Wong
2020-04-24 22:39     ` Ritesh Harjani [this message]

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=20200424223915.D5EB74C059@d06av22.portsmouth.uk.ibm.com \
    --to=riteshh@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.