lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfpegvgbQg9YTbpE6mtsXFQDZRMPgtmKV9O5L8h0cHP_QdWrQ@mail.gmail.com>
Date:	Thu, 25 Apr 2013 12:22:08 +0200
From:	Miklos Szeredi <miklos@...redi.hu>
To:	"Maxim V. Patlasov" <MPatlasov@...allels.com>
Cc:	Kirill Korotaev <dev@...allels.com>,
	Pavel Emelianov <xemul@...allels.com>,
	fuse-devel <fuse-devel@...ts.sourceforge.net>,
	Kernel Mailing List <linux-kernel@...r.kernel.org>,
	James Bottomley <jbottomley@...allels.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	Linux-Fsdevel <linux-fsdevel@...r.kernel.org>, devel@...nvz.org
Subject: Re: [PATCH 04/14] fuse: Prepare to handle multiple pages in writeback

On Mon, Apr 1, 2013 at 12:41 PM, Maxim V. Patlasov
<MPatlasov@...allels.com> wrote:
>
> The .writepages callback will issue writeback requests with more than one
> page aboard. Make existing end/check code be aware of this.
>
> Original patch by: Pavel Emelyanov <xemul@...nvz.org>

If this patch was written by Pavel and then modified by you then
please add  a "From:" header at the top of the patch instead.  See
Documentation/SubmittingPatches.

> Signed-off-by: Maxim Patlasov <MPatlasov@...allels.com>
> ---
>  fs/fuse/file.c |   22 +++++++++++++++-------
>  1 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 648de34..ee44b24 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -345,7 +345,8 @@ static bool fuse_page_is_writeback(struct inode *inode, pgoff_t index)
>
>                 BUG_ON(req->inode != inode);
>                 curr_index = req->misc.write.in.offset >> PAGE_CACHE_SHIFT;
> -               if (curr_index == index) {
> +               if (curr_index <= index &&
> +                   index < curr_index + req->num_pages) {
>                         found = true;
>                         break;
>                 }
> @@ -1295,7 +1296,10 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
>
>  static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
>  {
> -       __free_page(req->pages[0]);
> +       int i;
> +
> +       for (i = 0; i < req->num_pages; i++)
> +               __free_page(req->pages[i]);
>         fuse_file_put(req->ff, false);
>  }
>
> @@ -1304,10 +1308,13 @@ static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req)
>         struct inode *inode = req->inode;
>         struct fuse_inode *fi = get_fuse_inode(inode);
>         struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info;
> +       int i;
>
>         list_del(&req->writepages_entry);
> -       dec_bdi_stat(bdi, BDI_WRITEBACK);
> -       dec_zone_page_state(req->pages[0], NR_WRITEBACK_TEMP);
> +       for (i = 0; i < req->num_pages; i++) {
> +               dec_bdi_stat(bdi, BDI_WRITEBACK);
> +               dec_zone_page_state(req->pages[i], NR_WRITEBACK_TEMP);
> +       }
>         bdi_writeout_inc(bdi);
>         wake_up(&fi->page_waitq);
>  }
> @@ -1320,14 +1327,15 @@ __acquires(fc->lock)
>         struct fuse_inode *fi = get_fuse_inode(req->inode);
>         loff_t size = i_size_read(req->inode);
>         struct fuse_write_in *inarg = &req->misc.write.in;
> +       __u64 data_size = req->num_pages * PAGE_CACHE_SIZE;
>
>         if (!fc->connected)
>                 goto out_free;
>
> -       if (inarg->offset + PAGE_CACHE_SIZE <= size) {
> -               inarg->size = PAGE_CACHE_SIZE;
> +       if (inarg->offset + data_size <= size) {
> +               inarg->size = data_size;
>         } else if (inarg->offset < size) {
> -               inarg->size = size & (PAGE_CACHE_SIZE - 1);
> +               inarg->size = size - inarg->offset;
>         } else {
>                 /* Got truncated off completely */
>                 goto out_free;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ