linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: josef@toxicpanda.com
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Cc: Josef Bacik <jbacik@fb.com>
Subject: [PATCH 2/2] btrfs: increase ctx->pos for delayed dir index
Date: Mon, 24 Jul 2017 15:14:26 -0400	[thread overview]
Message-ID: <1500923666-29670-2-git-send-email-jbacik@fb.com> (raw)
In-Reply-To: <1500923666-29670-1-git-send-email-jbacik@fb.com>

From: Josef Bacik <jbacik@fb.com>

Our dir_context->pos is supposed to hold the next position we're
supposed to look.  If we successfully insert a delayed dir index we
could end up with a duplicate entry because we don't increase ctx->pos
after doing the dir_emit.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 fs/btrfs/delayed-inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 8ae409b..19e4ad2 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -1727,6 +1727,7 @@ int btrfs_readdir_delayed_dir_index(struct dir_context *ctx,
 
 		if (over)
 			return 1;
+		ctx->pos++;
 	}
 	return 0;
 }
-- 
2.7.4


  reply	other threads:[~2017-07-24 19:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 19:14 [PATCH 1/2][v2] btrfs: fix readdir deadlock with pagefault josef
2017-07-24 19:14 ` josef [this message]
2017-07-28 17:33   ` [PATCH 2/2] btrfs: increase ctx->pos for delayed dir index Liu Bo
2017-07-28 15:27 ` [PATCH 1/2][v2] btrfs: fix readdir deadlock with pagefault David Sterba
2017-07-28 17:33 ` Liu Bo
  -- strict thread matches above, loose matches on Subject: below --
2017-08-01 19:50 [PATCH 1/2][v3] " josef
2017-08-01 19:51 ` [PATCH 2/2] btrfs: increase ctx->pos for delayed dir index josef

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=1500923666-29670-2-git-send-email-jbacik@fb.com \
    --to=josef@toxicpanda.com \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).