From patchwork Fri Jan 6 20:54:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9501815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E544606E1 for ; Fri, 6 Jan 2017 20:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9380E28524 for ; Fri, 6 Jan 2017 20:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 886CB28526; Fri, 6 Jan 2017 20:56:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1468F28527 for ; Fri, 6 Jan 2017 20:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761009AbdAFUzx (ORCPT ); Fri, 6 Jan 2017 15:55:53 -0500 Received: from mailrelay112.isp.belgacom.be ([195.238.20.139]:62375 "EHLO mailrelay112.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161709AbdAFUyw (ORCPT ); Fri, 6 Jan 2017 15:54:52 -0500 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2DJAgADA3BY/2ZisVteHQEFAQsBgzkBA?= =?us-ascii?q?QEBAR9AgSuNV3KRVgGScIIPggmGIgKBVUAUAQIBAQEBAQEBYyiEaQYnLyMQGSY?= =?us-ascii?q?SOR4GE4hjEbI0OoofAQEIKIZFjw0FmxWRRwKBdYhShhKSUR84gSEYGIZaPTWIZ?= =?us-ascii?q?gEBAQ?= X-IPAS-Result: =?us-ascii?q?A2DJAgADA3BY/2ZisVteHQEFAQsBgzkBAQEBAR9AgSuNV3K?= =?us-ascii?q?RVgGScIIPggmGIgKBVUAUAQIBAQEBAQEBYyiEaQYnLyMQGSYSOR4GE4hjEbI0O?= =?us-ascii?q?oofAQEIKIZFjw0FmxWRRwKBdYhShhKSUR84gSEYGIZaPTWIZgEBAQ?= Received: from 102.98-177-91.adsl-dyn.isp.belgacom.be (HELO inkjet2.lan) ([91.177.98.102]) by relay.skynet.be with ESMTP; 06 Jan 2017 21:54:49 +0100 From: Fabian Frederick To: Jan Kara Cc: fabf@skynet.be, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 10/12 linux-next] udf: atomically read inode size Date: Fri, 6 Jan 2017 21:54:41 +0100 Message-Id: <1483736083-25193-1-git-send-email-fabf@skynet.be> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1483736037-25111-1-git-send-email-fabf@skynet.be> References: <1483736037-25111-1-git-send-email-fabf@skynet.be> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP See i_size_read() comments in include/linux/fs.h Signed-off-by: Fabian Frederick --- fs/udf/lowlevel.c | 2 +- fs/udf/super.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c index 6ad5a45..5c7ec12 100644 --- a/fs/udf/lowlevel.c +++ b/fs/udf/lowlevel.c @@ -58,7 +58,7 @@ unsigned long udf_get_last_block(struct super_block *sb) */ if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock) || lblock == 0) - lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits; + lblock = i_size_read(bdev->bd_inode) >> sb->s_blocksize_bits; if (lblock) return lblock - 1; diff --git a/fs/udf/super.c b/fs/udf/super.c index 9256117..6b5a1a4 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1213,7 +1213,8 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index) struct udf_inode_info *vati; uint32_t pos; struct virtualAllocationTable20 *vat20; - sector_t blocks = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits; + sector_t blocks = i_size_read(sb->s_bdev->bd_inode) >> + sb->s_blocksize_bits; udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block); if (!sbi->s_vat_inode && @@ -1803,7 +1804,7 @@ static int udf_check_anchor_block(struct super_block *sb, sector_t block, if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV) && udf_fixed_to_variable(block) >= - sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits) + i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits) return -EAGAIN; bh = udf_read_tagged(sb, block, block, &ident); @@ -1865,7 +1866,7 @@ static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock, last[last_count++] = *lastblock - 152; for (i = 0; i < last_count; i++) { - if (last[i] >= sb->s_bdev->bd_inode->i_size >> + if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits) continue; ret = udf_check_anchor_block(sb, last[i], fileset);