mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel@vger.kernel.org, jfs-discussion@lists.sourceforge.net
Subject: Re: [PATCH 1/1 linux-next] jfs: atomically read inode size
Date: Tue, 24 Jan 2017 08:30:11 -0600	[thread overview]
Message-ID: <65889b39-44d0-e501-0bd6-8b8243bac85c@oracle.com> (raw)
In-Reply-To: <1530699262.895610.1485201121820.open-xchange@webmail.nmp.proximus.be>

On 01/23/2017 01:52 PM, Fabian Frederick wrote:
> 
> 
>> On 23 January 2017 at 19:43 Dave Kleikamp <dave.kleikamp@oracle.com> wrote:
>>
>>
>> On 01/23/2017 11:50 AM, Fabian Frederick wrote:
>>> See i_size_read() comments in include/linux/fs.h
>>
>> Is this fixing a real problem? Can the bd_inode size change while we're
>> mounting or resizing the filesystem?
>>
> 
> Behind good locking, there should be no problem.
> I made some patches like this to use read operation to remove any
> ambiguity.

There are a lot of places where i_size_read/write is used for bd_inode,
so I'll go ahead and take this patch for consistency of the code.

Thanks,
Shaggy

> 
> Regards,
> Fabian
> 
>>>
>>> Signed-off-by: Fabian Frederick <fabf@skynet.be>
>>> ---
>>>   fs/jfs/resize.c | 4 ++--
>>>   fs/jfs/super.c  | 4 ++--
>>>   2 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/fs/jfs/resize.c b/fs/jfs/resize.c
>>> index bd9b641..7ddcb44 100644
>>> --- a/fs/jfs/resize.c
>>> +++ b/fs/jfs/resize.c
>>> @@ -98,7 +98,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize,
>>> int newLogSize)
>>>              goto out;
>>>      }
>>>  
>>> -   VolumeSize = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
>>> +   VolumeSize = i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits;
>>>  
>>>      if (VolumeSize) {
>>>              if (newLVSize > VolumeSize) {
>>> @@ -211,7 +211,7 @@ int jfs_extendfs(struct super_block *sb, s64 newLVSize,
>>> int newLogSize)
>>>      txQuiesce(sb);
>>>  
>>>      /* Reset size of direct inode */
>>> -   sbi->direct_inode->i_size =  sb->s_bdev->bd_inode->i_size;
>>> +   sbi->direct_inode->i_size =  i_size_read(sb->s_bdev->bd_inode);
>>>  
>>>      if (sbi->mntflag & JFS_INLINELOG) {
>>>              /*
>>> diff --git a/fs/jfs/super.c b/fs/jfs/super.c
>>> index c64c257..ad02f00 100644
>>> --- a/fs/jfs/super.c
>>> +++ b/fs/jfs/super.c
>>> @@ -283,7 +283,7 @@ static int parse_options(char *options, struct
>>> super_block *sb, s64 *newLVSize,
>>>              }
>>>              case Opt_resize_nosize:
>>>              {
>>> -                   *newLVSize = sb->s_bdev->bd_inode->i_size >>
>>> +                   *newLVSize = i_size_read(sb->s_bdev->bd_inode) >>
>>>                              sb->s_blocksize_bits;
>>>                      if (*newLVSize == 0)
>>>                              pr_err("JFS: Cannot determine volume size\n");
>>> @@ -549,7 +549,7 @@ static int jfs_fill_super(struct super_block *sb, void
>>> *data, int silent)
>>>              goto out_unload;
>>>      }
>>>      inode->i_ino = 0;
>>> -   inode->i_size = sb->s_bdev->bd_inode->i_size;
>>> +   inode->i_size = i_size_read(sb->s_bdev->bd_inode);
>>>      inode->i_mapping->a_ops = &jfs_metapage_aops;
>>>      hlist_add_fake(&inode->i_hash);
>>>      mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
>>>

      reply	other threads:[~2017-01-24 14:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23 17:50 Fabian Frederick
2017-01-23 18:43 ` Dave Kleikamp
2017-01-23 19:52   ` Fabian Frederick
2017-01-24 14:30     ` Dave Kleikamp [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=65889b39-44d0-e501-0bd6-8b8243bac85c@oracle.com \
    --to=dave.kleikamp@oracle.com \
    --cc=fabf@skynet.be \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®