public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: John Stultz <john.stultz@linaro.org>
Cc: Felipe Balbi <balbi@ti.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Krzysztof Opasiak <k.opasiak@samsung.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michal Nazarewicz <mina86@mina86.com>,
	Robert Baldyga <r.baldyga@samsung.com>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-usb@vger.kernel.org
Subject: Re: Locking issues w/ functionfs gadget and aio?
Date: Sun, 21 Jun 2015 06:24:30 +0100	[thread overview]
Message-ID: <20150621052430.GA27824@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CALAqxLXPWhQvWfqrpw0MVygothMKhE++cPMj2ZjoZR7KVPwYXQ@mail.gmail.com>

On Fri, Jun 12, 2015 at 05:51:12PM -0700, John Stultz wrote:

> I'm not super sure what the right fix is, but if do something like the
> following (sorry, whitespace corrupted via copy/paste), I don't seem
> to run into the problem.

Looks sane.  Which tree would you prefer it to go through, vfs or usb?
BTW, in either case you'd need Signed-off-by: on that patch...

> diff --git a/drivers/usb/gadget/function/f_fs.c
> b/drivers/usb/gadget/function/f_fs.c
> index 3507f88..e322818 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -924,7 +924,8 @@ static ssize_t ffs_epfile_write_iter(struct kiocb
> *kiocb, struct iov_iter *from)
> 
>         kiocb->private = p;
> 
> -       kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> +       if (p->aio)
> +               kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> 
>         res = ffs_epfile_io(kiocb->ki_filp, p);
>         if (res == -EIOCBQUEUED)
> @@ -968,7 +969,8 @@ static ssize_t ffs_epfile_read_iter(struct kiocb
> *kiocb, struct iov_iter *to)
> 
>         kiocb->private = p;
> 
> -       kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> +       if(p->aio)
> +               kiocb_set_cancel_fn(kiocb, ffs_aio_cancel);
> 
>         res = ffs_epfile_io(kiocb->ki_filp, p);
>         if (res == -EIOCBQUEUED)
> 
> 
> Is there a better solution here? I'm not sure I see if the
> is_sync_kiocb(kiocb) check would ever be false from here, so I'm not
> sure if all the p->aio checking is really needed or not.
> 
> This issue seems to have been introduced with 70e60d917e91fff
> (gadget/function/f_fs.c: switch to ->{read,write}_iter())
> 
> thanks
> -john
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2015-06-21  5:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09  1:14 Locking issues w/ functionfs gadget and aio? John Stultz
2015-06-13  0:51 ` John Stultz
2015-06-21  5:24   ` Al Viro [this message]
2015-06-22 17:20     ` John Stultz
2015-07-01  9:59       ` Andrzej Pietrasiewicz

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=20150621052430.GA27824@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=andrzej.p@samsung.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.stultz@linaro.org \
    --cc=k.opasiak@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    --cc=r.baldyga@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox