From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2-1.4: fix sendfile locking
Date: Fri, 04 Dec 2009 14:13:27 -0800 [thread overview]
Message-ID: <4B198987.6060002@oracle.com> (raw)
In-Reply-To: <20091204220857.GT11402@wotan.suse.de>
Acked-by: Sunil Mushran <sunil.mushran@oracle.com>
Mark Fasheh wrote:
> ocfs2_sendfile() was duplicating locking which happens later on in
> ocfs2_readpage(). The double locking would sometimes cause a lockup in nfsd,
> which uses ->sendfile() for fast read support. An easy way to see this is to
> mount an exported ocfs2 fs on a client and initiate two parallel read/write
> dd commands to the same file when there is low memory on the server.
>
> Fix ocfs2_sendfile() so that it only takes and immediately drops the cluster
> lock. This is consistent with the locking in ocfs2_file_splice_read().
>
> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
>
> Index: linux/fs/ocfs2/file.c
> ===================================================================
> --- linux.orig/fs/ocfs2/file.c
> +++ linux/fs/ocfs2/file.c
> @@ -2511,15 +2511,14 @@ static ssize_t ocfs2_file_sendfile(struc
> mlog_errno(ret);
> goto bail;
> }
> + ocfs2_inode_unlock(inode, 0);
>
> - down_read(&OCFS2_I(inode)->ip_alloc_sem);
> -
> + /*
> + * This uses ->readpage, so we don't want to hold any cluster
> + * locks before the call.
> + */
> ret = generic_file_sendfile(in_file, ppos, count, actor, target);
>
> - up_read(&OCFS2_I(inode)->ip_alloc_sem);
> -
> - ocfs2_inode_unlock(inode, 0);
> -
> bail:
> mlog_exit(ret);
> return ret;
prev parent reply other threads:[~2009-12-04 22:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-04 22:08 [Ocfs2-devel] [PATCH] ocfs2-1.4: fix sendfile locking Mark Fasheh
2009-12-04 22:13 ` Sunil Mushran [this message]
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=4B198987.6060002@oracle.com \
--to=sunil.mushran@oracle.com \
--cc=ocfs2-devel@oss.oracle.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.