Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1412663yba; Tue, 2 Apr 2019 08:24:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+J4jNMFFhL/FGKdcWS8qA959IAJkTvnQRl3Za7Rgxdj8XkEj2IrHF2Wfc155eeCmuhMCa X-Received: by 2002:a63:1a42:: with SMTP id a2mr34191504pgm.358.1554218661117; Tue, 02 Apr 2019 08:24:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554218661; cv=none; d=google.com; s=arc-20160816; b=FhzulmscmepZ/a4vRBY9SLcTesmeQLVsSdmODcf8VlCFJoH2dS+XlrHhqiX2RlrnyM mLfDWIt9F4t4yvF3YP/0EPAAMT6RYlDcA6cIqQOHEsRSqOMKSbCq+iYAbgR2Vg/23wgG g1afvE4shT0B9gkWRMlstC3TU9bXwIRH7rju2bWMTuXKYpr7QqqSA/vHok24iDzOes2k uLbp5OUIgYq3nBkd8pfu6s9WK6xRAaL63Yb6DdXFqEKtQ+UBquQ5EYTvnxVvfoBIBl9X pqWBQhTbAH6CR/saewiXuATF3xLP3nU6fO2DH9RvlImlhYYLWux8DXFrqTE2MFwBEsrG r9XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=avfSDvS/oIHZRWTZ9z6MnUL9riVtq8V3TIvj2qFNgHQ=; b=BnAKpLQZqkHKoUQ9HGASiSKsHVuXGMI668oxA0I2N2J7JuuJ2VhOB+F2RmR0HuByMf 1T827lCQoFDO5L5UuIrrSLUFxD4+4HOxRiiVgB7KSXM6/hyJHqMi5DaFxdCfA92YJ3WG 8oRR5xS1dBX3gwSRfNUewTTrcJ/E5F4QQ66hyo7A0LVqghs7t9AXIf30ROD/O5x6b24d Wh7yaCe2jiJXmRe1HOytyq/f9oKU8qZ8EtRFUWlw7KsMcUGOyCCxvyzsRr5VGWTXx66s kOaZRzFODf7/Zs/uqFrw9Ih8cHmi6j4HbJDQe10cVzMXAj5xJrxi8FPwrzT5sBQ1QC/5 fpCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t17si11288508pfe.250.2019.04.02.08.24.05; Tue, 02 Apr 2019 08:24:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731907AbfDBNnR (ORCPT + 99 others); Tue, 2 Apr 2019 09:43:17 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:43650 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731516AbfDBNkL (ORCPT ); Tue, 2 Apr 2019 09:40:11 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJe4-0002oo-69; Tue, 02 Apr 2019 14:40:08 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdx-0004va-4c; Tue, 02 Apr 2019 14:40:01 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Theodore Ts'o" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 64/99] ext4: check for shutdown and r/o file system in ext4_write_inode() In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit 18f2c4fcebf2582f96cbd5f2238f4f354a0e4847 upstream. If the file system has been shut down or is read-only, then ext4_write_inode() needs to bail out early. Also use jbd2_complete_transaction() instead of ext4_force_commit() so we only force a commit if it is needed. Signed-off-by: Theodore Ts'o [bwh: Backported to 3.16: - Open-code sb_rdonly() - Drop ext4_forced_shutdown() check] Signed-off-by: Ben Hutchings --- --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4658,7 +4658,8 @@ int ext4_write_inode(struct inode *inode { int err; - if (WARN_ON_ONCE(current->flags & PF_MEMALLOC)) + if (WARN_ON_ONCE(current->flags & PF_MEMALLOC) || + (inode->i_sb->s_flags & MS_RDONLY)) return 0; if (EXT4_SB(inode->i_sb)->s_journal) { @@ -4676,7 +4677,8 @@ int ext4_write_inode(struct inode *inode if (wbc->sync_mode != WB_SYNC_ALL || wbc->for_sync) return 0; - err = ext4_force_commit(inode->i_sb); + err = jbd2_complete_transaction(EXT4_SB(inode->i_sb)->s_journal, + EXT4_I(inode)->i_sync_tid); } else { struct ext4_iloc iloc;