public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: shaggy@kernel.org
Cc: jfs-discussion@lists.sourceforge.net,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	lists@nerdbynature.de, ben@decadent.org.uk,
	stable <stable@vger.kernel.org>,
	hmage@hmage.net,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: JFS readdir() issues in stable 3.2
Date: Sat, 21 Mar 2015 00:33:48 +0100	[thread overview]
Message-ID: <550CAE5C.9010101@nod.at> (raw)

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

Hi!

Mainline commit 44512449c0ab368889dd13ae0031fba74ee7e1d2
(jfs: fix readdir cookie incompatibility with NFSv4) does not work as expected on 3.2.
Maybe on other stable kernels too.

UML stumbled over it:
https://bugzilla.kernel.org/show_bug.cgi?id=94741

If you run the attached readdir.c on a JFS on stable 3.2.51+ readdir() will not
increment the directory offset nor return NULL, hence the caller will loop forever.
It looks like if the current directory offset is > 0 and you run seekdir(telldir())
the next readdir() call will not increment it.

Dave, has your fix some unnamed dependencies which need backporting too?

Thanks,
//richard

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: readdir.c --]
[-- Type: text/x-csrc; name="readdir.c", Size: 462 bytes --]

#include <stdio.h>
#include <dirent.h>
#include <assert.h>

int main(int argc, char *argv[])
{
	DIR *dirp;
	struct dirent *dent;
	off_t dpos;

	if (argc < 2) {
		fprintf(stderr, "Usage: %s DIR\n", argv[0]);
		return 1;
	}

	dirp = opendir(argv[1]);
	assert(dirp);
	dpos = 0;

	for (;;) {
		seekdir(dirp, dpos);
		dent = readdir(dirp);
		if (!dent)
			break;
		assert(dpos != telldir(dirp));
		dpos = telldir(dirp);
	}

	return 0;
}

             reply	other threads:[~2015-03-20 23:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 23:33 Richard Weinberger [this message]
2015-03-21 21:58 ` JFS readdir() issues in stable 3.2 Dave Kleikamp
2015-03-21 22:08   ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550CAE5C.9010101@nod.at \
    --to=richard@nod.at \
    --cc=ben@decadent.org.uk \
    --cc=hmage@hmage.net \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lists@nerdbynature.de \
    --cc=shaggy@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox