All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Schmidt <list.btrfs@jan-o-sch.net>
To: Alex Lyakas <alex.bolshoy.btrfs@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org,
	Anand jain <Anand.Jain@oracle.com>,
	Alexander Block <ablock84@googlemail.com>
Subject: Re: btrfs send/receive review by vfs folks
Date: Mon, 24 Sep 2012 11:27:29 +0200	[thread overview]
Message-ID: <50602781.9010009@jan-o-sch.net> (raw)
In-Reply-To: <CAHf9xvaH6HoapVVqdTAXdFAZsEfvN7-xjoGtj31Lw=fUbY3LXA@mail.gmail.com>

Hi Alex,

On Mon, September 24, 2012 at 11:13 (+0200), Alex Lyakas wrote:
> Hi,
> 
>> write_buf:
>> Used to write the stream to a user space supplied pipe. Please note
>> the ERESTARTSYS comment there, I need some help here as I don't know
>> how to handle that correctly. If I ignore the return value, it loops
>> forever. If I bail out to user space, it reenters the ioctl and starts
>> from the beginning (which is really bad). I have two possible
>> solutions in my mind.
>> 1. Store some kind of state in the ioctl arguments so that we can
>> continue where we stopped when the ioctl reenters. This would however
>> complicate the code a lot.
>> 2. Spawn a thread when the ioctl is called and leave the ioctl
>> immediately. I don't know if ERESTARTSYS can happen in vfs_xxx calls
>> if they happen from a non syscall thread.
> 
> I am hitting the ERESTARTSYS issue also. To easiest way to repro this
> is to stop the user process in gdb.
> As Alexander mentioned, restarting the ioctl from the beginning is
> really bad, because some commands were already sent to the pipe, and
> possibly consumed by the user mode (dump_thread). Also the command, on
> which vfs_write() hit ERESTARTSYS, might not have been pushed fully to
> the pipe. So if the ioctl() restarts, it starts filling the pipe with
> duplicate commands, and at least one command in the pipe might be
> corrupted. So the receive part cannot process such stream successfully
> (usually it hits crc error).
> 
> In addition to what Alexander suggested, I have a third suggestion,
> but I would like to know whether community believes this issue is
> worth to fix.

It's a must-fix in my opinion. As you mentioned, it's easy to hit. Second, code
like this doesn't look like it should be in mainline at all:

 391                 /* TODO handle that correctly */
 392                 /*if (ret == -ERESTARTSYS) {
 393                         continue;
 394                 }*/

I'm looking forward to your proposal, preferably in form of a patch :-)

-Jan

  reply	other threads:[~2012-09-24  9:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-01 12:09 btrfs send/receive review by vfs folks Alexander Block
2012-09-24  9:13 ` Alex Lyakas
2012-09-24  9:27   ` Jan Schmidt [this message]
2012-09-27 19:36     ` Alex Lyakas
2012-10-04 15:59     ` Alex Lyakas
2012-10-06  9:40       ` Martin Steigerwald
2012-10-07 10:48         ` Alex Lyakas
2012-10-07 10:53           ` Martin Steigerwald
2012-10-07 11:08             ` Alex Lyakas
2012-10-07 12:59               ` Martin Steigerwald
2012-10-08  9:26       ` Jan Schmidt
2012-10-08 11:38         ` Alex Lyakas
2012-10-08 13:37           ` Jan Schmidt
2012-10-10 20:28             ` Alex Lyakas

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=50602781.9010009@jan-o-sch.net \
    --to=list.btrfs@jan-o-sch.net \
    --cc=Anand.Jain@oracle.com \
    --cc=ablock84@googlemail.com \
    --cc=alex.bolshoy.btrfs@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@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 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.