Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565194 > unrolled thread

[PATCH 1/1 linux-next] ext4: atomically read inode size

Started byFabian Frederick <fabf@skynet.be>
First post2017-01-23 19:00 +0100
Last post2017-01-23 19:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/1 linux-next] ext4: atomically read inode size Fabian Frederick <fabf@skynet.be> - 2017-01-23 19:00 +0100
    Re: [PATCH 1/1 linux-next] ext4: atomically read inode size Theodore Ts'o <tytso@mit.edu> - 2017-01-23 19:30 +0100

#1565194 — [PATCH 1/1 linux-next] ext4: atomically read inode size

FromFabian Frederick <fabf@skynet.be>
Date2017-01-23 19:00 +0100
Subject[PATCH 1/1 linux-next] ext4: atomically read inode size
Message-ID<t2R4l-11t-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1565218

FromTheodore Ts'o <tytso@mit.edu>
Date2017-01-23 19:30 +0100
Message-ID<t2Rxn-1pg-1@gated-at.bofh.it>
In reply to#1565194
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web