Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751433AbbG2JeJ (ORCPT ); Wed, 29 Jul 2015 05:34:09 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:60216 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750803AbbG2JeG (ORCPT ); Wed, 29 Jul 2015 05:34:06 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-e1-55b89e0baa0a From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs: freeze filesystem when fail to update meta page due to IO error Date: Wed, 29 Jul 2015 17:33:13 +0800 Message-id: <011b01d0c9e1$b82b3b90$2881b2b0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdDJ4VfFrvBfsFG/RgK+H8zCR/to2Q== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrDLMWRmVeSWpSXmKPExsVy+t9jAV3ueTtCDe6fFLZ4sn4Ws8WlRe4W l3fNYXNg9ti0qpPNY/eCz0wenzfJBTBHcdmkpOZklqUW6dslcGXcf72HpeAOe8WvHy/YGxgn sXUxcnJICJhI9N+eAmWLSVy4tx7I5uIQEljKKPGidQMjhPOKUeL04bdMIFVsAioSyzv+g9ki QPahRZfZQWxmAQ+Jxo7vrCC2sECExOcfG8FsFgFVifdfG1lAbF4BS4nbT+czQdiCEj8m32OB 6NWSWL/zOBOELS+xec1bZoiLFCR2nH3NCLFLT2Lqp4vMEDXiEhuP3GKZwCgwC8moWUhGzUIy ahaSlgWMLKsYJVILkguKk9JzDfNSy/WKE3OLS/PS9ZLzczcxgsP4mdQOxoO73A8xCnAwKvHw crrsCBViTSwrrsw9xCjBwawkwhs0AyjEm5JYWZValB9fVJqTWnyIUZqDRUmcV3bD5lAhgfTE ktTs1NSC1CKYLBMHp1QDY9g0rfdzd9bPD93qzKOc3eEg0JvMpvn81nVl/gc2QlwlFp/+R1fO vyVl1O170+n0ta+HzlfG/D31RHTjTj62536NhUq6Tw7FHPyr9cLwurau/EOnoov/7a9Ulp/c VfAo79OW/2GMORpcsdL+gQIzRB/cZPmxVjqxevm2LYcVirbuteVx3T/bTYmlOCPRUIu5qDgR ABtYsbhfAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1195 Lines: 43 In get_meta_page, we guarantee no failure for the returned page, but sometimes, IO error from device will incur returning an non-updated page. Then, we still use this page as updated one, exception could happen when using this kind of page. So in this condition, we'd better freeze fs by making fs readonly and and stop doing checkpoint. Signed-off-by: Chao Yu --- fs/f2fs/checkpoint.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 84e0dfe..c311176 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -79,6 +79,14 @@ repeat: f2fs_put_page(page, 1); goto repeat; } + + /* + * if there is any IO error when accessing device, make our filesystem + * readonly and make sure do not write checkpoint with non-uptodate + * meta page. + */ + if (unlikely(!PageUptodate(page))) + f2fs_stop_checkpoint(sbi); out: return page; } -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/