linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1 linux-next] ext4: atomically read inode size
@ 2017-01-23 17:56 Fabian Frederick
  2017-01-23 18:26 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2017-01-23 17:56 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, linux-kernel, fabf

See i_size_read() comments in include/linux/fs.h

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/ext4/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9d15a62..3746f77 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3798,7 +3798,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		goto cantfind_ext4;
 
 	/* check blocks count against device size */
-	blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
+	blocks_count = i_size_read(sb->s_bdev->bd_inode) >>
+		       sb->s_blocksize_bits;
 	if (blocks_count && ext4_blocks_count(es) > blocks_count) {
 		ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu "
 		       "exceeds size of device (%llu blocks)",
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1 linux-next] ext4: atomically read inode size
  2017-01-23 17:56 [PATCH 1/1 linux-next] ext4: atomically read inode size Fabian Frederick
@ 2017-01-23 18:26 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2017-01-23 18:26 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-ext4, linux-kernel

On Mon, Jan 23, 2017 at 06:56:09PM +0100, Fabian Frederick wrote:
> See i_size_read() comments in include/linux/fs.h
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
>  fs/ext4/super.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 9d15a62..3746f77 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3798,7 +3798,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  		goto cantfind_ext4;
>  
>  	/* check blocks count against device size */
> -	blocks_count = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
> +	blocks_count = i_size_read(sb->s_bdev->bd_inode) >>
> +		       sb->s_blocksize_bits;
>  	if (blocks_count && ext4_blocks_count(es) > blocks_count) {
>  		ext4_msg(sb, KERN_WARNING, "bad geometry: block count %llu "
>  		       "exceeds size of device (%llu blocks)",

Um, this is at mount time, and we're talking about the i_size of the
block device --- which typically isn't moving around a huge amount.

      	     	       		       	      - Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-23 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 17:56 [PATCH 1/1 linux-next] ext4: atomically read inode size Fabian Frederick
2017-01-23 18:26 ` Theodore Ts'o

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).