From patchwork Fri Jan 24 22:32:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 3536411 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4B77DC02DC for ; Fri, 24 Jan 2014 22:33:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44F2520125 for ; Fri, 24 Jan 2014 22:33:10 +0000 (UTC) Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 77EE420123 for ; Fri, 24 Jan 2014 22:33:05 +0000 (UTC) Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s0OMWOuP031879 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Jan 2014 22:32:24 GMT Received: from oss.oracle.com (oss-external.oracle.com [137.254.96.51]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s0OMWNf9015815 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Jan 2014 22:32:23 GMT Received: from localhost ([127.0.0.1] helo=oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1W6pIV-0000IY-DB; Fri, 24 Jan 2014 14:32:23 -0800 Received: from acsinet21.oracle.com ([141.146.126.237]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1W6pIF-0000HN-Pg for ocfs2-devel@oss.oracle.com; Fri, 24 Jan 2014 14:32:07 -0800 Received: from userp1030.oracle.com (userp1030.oracle.com [156.151.31.80]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s0OMW7b6015087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 24 Jan 2014 22:32:07 GMT Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) by userp1030.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s0OMW6jY012363 for ; Fri, 24 Jan 2014 22:32:06 GMT Received: from akpm3.mtv.corp.google.com (unknown [216.239.45.95]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 270BD8CC; Fri, 24 Jan 2014 22:32:06 +0000 (UTC) Date: Fri, 24 Jan 2014 14:32:04 -0800 From: Andrew Morton To: Mark Fasheh Message-Id: <20140124143204.03ee21c5d6e9eabda00f9628@linux-foundation.org> In-Reply-To: <20140124222119.GF24361@wotan.suse.de> References: <20140124204700.532BA31C1B6@corp2gmr1-1.hot.corp.google.com> <52E2E2E1.2060601@suse.de> <20140124222119.GF24361@wotan.suse.de> X-Mailer: Sylpheed 3.2.0beta5 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Flow-Control-Info: class=Pass-to-MM reputation=ipRisk-All ip=140.211.169.12 ct-class=T1 ct-vol1=0 ct-vol2=4 ct-vol3=4 ct-risk=10 ct-spam1=0 ct-spam2=0 ct-bulk=91 rcpts=1 size=1590 X-SPF-Info: PASS::mail.linuxfoundation.org X-Sendmail-CM-Score: 0.00% X-Sendmail-CM-Analysis: v=2.1 cv=LpmrlBtc c=1 sm=1 tr=0 a=5MPDoNpceV4HFXFrvkM3CQ==:117 a=5MPDoNpceV4HFXFrvkM3CQ==:17 a=f-KVbQ0nzC0A:10 a=NEiEQogP1MkA:10 a=kj9zAlcOel0A:10 a=Z4Rwk6OoAAAA:8 a=1XWaLZrsAAAA:8 a=ag1SF4gXAAAA:8 a=U7rBDlIgOHUA:10 a=pGLkceISAAAA:8 a=K1 T5efVghGHNIJr1g0QA:9 a=CjuIK1q_8ugA:10 a=0kPLrQdw3YYA:10 a=jbrJJM5MRmoA:10 a=MSl-tDqOz04A:10 X-Sendmail-CT-Classification: not spam X-Sendmail-CT-RefID: str=0001.0A090207.52E2E9E6.00A0:SCFSTAT19734153, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Cc: ocfs2-devel@oss.oracle.com Subject: Re: [Ocfs2-devel] [patch 01/11] ocfs2: fix ocfs2_sync_file() if filesystem is readonly X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, 24 Jan 2014 14:21:19 -0800 Mark Fasheh wrote: > On Fri, Jan 24, 2014 at 04:02:09PM -0600, Goldwyn Rodrigues wrote: > > > > > > On 01/24/2014 02:46 PM, akpm@linux-foundation.org wrote: > > > From: Younger Liu > > > Subject: ocfs2: fix ocfs2_sync_file() if filesystem is readonly > > > > > > If filesystem is readonly, there is no need to flush drive's caches or > > > force any uncommitted transactions. > > > > An ocfs2 filesystem can be set to read-only because of an error, in > > which case, you should return -EROFS. > > > > Nak. > > Goldwyn's right actually - disregard my sign off for the last one. > > Basically the patch does this: > > if (we're in some readonly state) > return 0; > > What we want, at the top of ocfs2_sync_file() is a return of -EROFS. This > will satisfy Goldwyn's requirement that we bubble -EROFS up the stack but at > the same time avoiding the extra work of trying to sync on a RO fs. > > So the new version of the patch would be: > > if (we're in some readonly state) > return -EROFS; > So it's this? Acked-by: Goldwyn Rodrigues --- a/fs/ocfs2/file.c~ocfs2-fix-ocfs2_sync_file-if-filesystem-is-readonly +++ a/fs/ocfs2/file.c @@ -185,6 +185,9 @@ static int ocfs2_sync_file(struct file * file->f_path.dentry->d_name.name, (unsigned long long)datasync); + if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) + return -EROFS; + err = filemap_write_and_wait_range(inode->i_mapping, start, end); if (err) return err;