Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751336AbbKNKc4 (ORCPT ); Sat, 14 Nov 2015 05:32:56 -0500 Received: from mail-oi0-f49.google.com ([209.85.218.49]:36409 "EHLO mail-oi0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbbKNKcy (ORCPT ); Sat, 14 Nov 2015 05:32:54 -0500 MIME-Version: 1.0 In-Reply-To: <56468C1E.2060401@oracle.com> References: <56468C1E.2060401@oracle.com> Date: Sat, 14 Nov 2015 11:32:54 +0100 Message-ID: Subject: Re: Endless getdents() in vfat filesystem From: Richard Weinberger To: Vegard Nossum Cc: OGAWA Hirofumi , LKML Content-Type: multipart/mixed; boundary=001a113cc588e13b8905247db27c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2060 Lines: 50 --001a113cc588e13b8905247db27c Content-Type: text/plain; charset=UTF-8 On Sat, Nov 14, 2015 at 2:19 AM, Vegard Nossum wrote: > Hi, > > Using the attached disk image I observe that getdents() never returns > the end of the directory, i.e. mounting the disk image on a loopback > device and running 'ls' under strace shows an endless stream of: > > getdents(3, /* 2 entries */, 32768) = 48 > getdents(3, /* 2 entries */, 32768) = 48 > getdents(3, /* 2 entries */, 32768) = 48 > ... Please more details. Is this image hand crafted? If not, how has it been created? Is is supposed to work? >From a quick look it seems as the root directory is bad but we report progress in ->iterate. ctx->pos is 2, we set it back to 0, because of the faked dot entries. but fat_get_entry() did not make any progress and we report 0 back to VFS. So, VFS sees progress and the game continues. Does the attached patch help? -- Thanks, //richard --001a113cc588e13b8905247db27c Content-Type: text/plain; charset=US-ASCII; name="__fat_readdir_cpos_fix.diff" Content-Disposition: attachment; filename="__fat_readdir_cpos_fix.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_igyyelv11 ZGlmZiAtLWdpdCBhL2ZzL2ZhdC9kaXIuYyBiL2ZzL2ZhdC9kaXIuYwppbmRleCA0YWZjNGQ5Li43 ZjY2YTM4IDEwMDY0NAotLS0gYS9mcy9mYXQvZGlyLmMKKysrIGIvZnMvZmF0L2Rpci5jCkBAIC01 ODYsOCArNTg2LDEyIEBAIHN0YXRpYyBpbnQgX19mYXRfcmVhZGRpcihzdHJ1Y3QgaW5vZGUgKmlu b2RlLCBzdHJ1Y3QgZmlsZSAqZmlsZSwKIAogCWJoID0gTlVMTDsKIGdldF9uZXc6Ci0JaWYgKGZh dF9nZXRfZW50cnkoaW5vZGUsICZjcG9zLCAmYmgsICZkZSkgPT0gLTEpCisJaWYgKGZhdF9nZXRf ZW50cnkoaW5vZGUsICZjcG9zLCAmYmgsICZkZSkgPT0gLTEpIHsKKwkJaWYgKGNwb3MgPT0gMCkK KwkJCWNwb3MgPSAyOworCiAJCWdvdG8gZW5kX29mX2RpcjsKKwl9CiBwYXJzZV9yZWNvcmQ6CiAJ bnJfc2xvdHMgPSAwOwogCS8qCg== --001a113cc588e13b8905247db27c-- -- 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/