All of lore.kernel.org
 help / color / mirror / Atom feed
* JFS readdir() issues in stable 3.2
@ 2015-03-20 23:33 Richard Weinberger
  2015-03-21 21:58 ` Dave Kleikamp
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2015-03-20 23:33 UTC (permalink / raw)
  To: shaggy
  Cc: jfs-discussion, linux-fsdevel, Al Viro, lists, ben, stable,
	hmage, linux-kernel

[-- 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;
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: JFS readdir() issues in stable 3.2
  2015-03-20 23:33 JFS readdir() issues in stable 3.2 Richard Weinberger
@ 2015-03-21 21:58 ` Dave Kleikamp
  2015-03-21 22:08   ` Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Kleikamp @ 2015-03-21 21:58 UTC (permalink / raw)
  To: Richard Weinberger, shaggy
  Cc: jfs-discussion, linux-fsdevel, Al Viro, lists, ben, stable,
	hmage, linux-kernel

On 03/20/2015 06:33 PM, Richard Weinberger wrote:
> 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.

The backport failed to pass the proper position to filldir() for the .
and .. entries. I've attached a proposed patch to the above bug.

> 
> Dave, has your fix some unnamed dependencies which need backporting too?
> 
> Thanks,
> //richard

Thanks!
Shaggy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: JFS readdir() issues in stable 3.2
  2015-03-21 21:58 ` Dave Kleikamp
@ 2015-03-21 22:08   ` Richard Weinberger
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2015-03-21 22:08 UTC (permalink / raw)
  To: Dave Kleikamp, shaggy
  Cc: jfs-discussion, linux-fsdevel, Al Viro, lists, ben, stable,
	hmage, linux-kernel

Am 21.03.2015 um 22:58 schrieb Dave Kleikamp:
> On 03/20/2015 06:33 PM, Richard Weinberger wrote:
>> 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.
> 
> The backport failed to pass the proper position to filldir() for the .
> and .. entries. I've attached a proposed patch to the above bug.

Thanks for sorting this out! :-)
//richard

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-21 22:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20 23:33 JFS readdir() issues in stable 3.2 Richard Weinberger
2015-03-21 21:58 ` Dave Kleikamp
2015-03-21 22:08   ` Richard Weinberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.