From patchwork Fri Jul 7 21:27:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 785773 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3x474r5MbCz9sBR for ; Sat, 8 Jul 2017 07:28:12 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752020AbdGGV2I (ORCPT ); Fri, 7 Jul 2017 17:28:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37988 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751034AbdGGV2G (ORCPT ); Fri, 7 Jul 2017 17:28:06 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2867861B82; Fri, 7 Jul 2017 21:28:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2867861B82 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=agruenba@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2867861B82 Received: from nux.redhat.com (ovpn-116-88.ams2.redhat.com [10.36.116.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 70FD26060D; Fri, 7 Jul 2017 21:28:04 +0000 (UTC) From: Andreas Gruenbacher To: Christoph Hellwig Cc: Andreas Gruenbacher , Jan Kara , linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Subject: [PATCH v4 1/3] ext4: Add missing locking around iomap_seek_{hole, data} Date: Fri, 7 Jul 2017 23:27:59 +0200 Message-Id: <1499462881-4238-2-git-send-email-agruenba@redhat.com> In-Reply-To: <1499462881-4238-1-git-send-email-agruenba@redhat.com> References: <1499462881-4238-1-git-send-email-agruenba@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 07 Jul 2017 21:28:06 +0000 (UTC) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Add back the inode locking that "ext4: Switch to iomap for SEEK_HOLE / SEEK_DATA" blew away. We can use inode_lock_shared instead of inode_lock instead, though. Signed-off-by: Andreas Gruenbacher --- fs/ext4/file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 02bbf2c..699a676 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c @@ -459,10 +459,14 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int whence) return generic_file_llseek_size(file, offset, whence, maxbytes, i_size_read(inode)); case SEEK_HOLE: + inode_lock_shared(inode); offset = iomap_seek_hole(inode, offset, &ext4_iomap_ops); + inode_unlock_shared(inode); break; case SEEK_DATA: + inode_lock_shared(inode); offset = iomap_seek_data(inode, offset, &ext4_iomap_ops); + inode_unlock_shared(inode); break; }