From: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: Chris Mason <chris.mason@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix directory offsets for '.' and '..' entries
Date: Mon, 12 Sep 2011 08:49:22 +0900 [thread overview]
Message-ID: <4E6D4902.8060303@jp.fujitsu.com> (raw)
In-Reply-To: <1315773216-8490-1-git-send-email-notasas@gmail.com>
The same patch has been posted about one month ago.
http://marc.info/?l=linux-btrfs&m=131363399500506&w=2
Thanks,
Tsutomu
(2011/09/12 5:33), Grazvydas Ignotas wrote:
> Currently getdents syscall returns wrong offset for '.' directory entry,
> which confuses some programs like wine. This can be observed with an
> example program getdents(2) manpage:
>
> $ ./a.out /testfs/
> --------------- nread=96 ---------------
> i-node# file type d_reclen d_off d_name
> 256 directory 24 2 .
> 256 directory 24 2 ..
> 257 regular 24 3 a
> 258 regular 24 2147483647 b
>
> Fix this by passing correct offsets to filldir().
>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> ---
> fs/btrfs/inode.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 0ccc743..5e7460b 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -4125,7 +4125,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent,
>
> /* special case for "." */
> if (filp->f_pos == 0) {
> - over = filldir(dirent, ".", 1, 1, btrfs_ino(inode), DT_DIR);
> + over = filldir(dirent, ".", 1, 0, btrfs_ino(inode), DT_DIR);
> if (over)
> return 0;
> filp->f_pos = 1;
> @@ -4133,8 +4133,7 @@ static int btrfs_real_readdir(struct file *filp, void *dirent,
> /* special case for .., just use the back ref */
> if (filp->f_pos == 1) {
> u64 pino = parent_ino(filp->f_path.dentry);
> - over = filldir(dirent, "..", 2,
> - 2, pino, DT_DIR);
> + over = filldir(dirent, "..", 2, 1, pino, DT_DIR);
> if (over)
> return 0;
> filp->f_pos = 2;
next prev parent reply other threads:[~2011-09-11 23:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-11 20:33 [PATCH] btrfs: fix directory offsets for '.' and '..' entries Grazvydas Ignotas
2011-09-11 21:06 ` Christoph Hellwig
2011-09-12 0:21 ` Grazvydas Ignotas
2011-09-11 23:49 ` Tsutomu Itoh [this message]
2011-09-18 15:09 ` Chris Mason
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=4E6D4902.8060303@jp.fujitsu.com \
--to=t-itoh@jp.fujitsu.com \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=notasas@gmail.com \
/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 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.