From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: lock the page in __ocfs2_page_mkwrite()
Date: Wed, 17 Nov 2010 15:21:49 -0800 [thread overview]
Message-ID: <20101117232149.GE25677@mail.oracle.com> (raw)
In-Reply-To: <201011050455.oA52fktp020706@rcsinet15.oracle.com>
On Fri, Nov 05, 2010 at 12:53:16PM +0800, Wengang Wang wrote:
Here's review based on the assumption we need this change.
> @@ -1097,6 +1097,7 @@ static int ocfs2_grab_pages_for_write(struct address_space *mapping,
> unsigned long start, target_index, end_index, index;
> struct inode *inode = mapping->host;
> loff_t last_byte;
> + int lockpg= !PageLocked(mmap_page);
This change is not necessary. If mmap_page exists, it came from
__ocfs2_page_mkwrite(), where you've locked it, so you know it is
locked.
>
> target_index = user_pos >> PAGE_CACHE_SHIFT;
>
> @@ -1133,11 +1134,15 @@ static int ocfs2_grab_pages_for_write(struct address_space *mapping,
> * ocfs2_pagemkwrite() is a little different
> * and wants us to directly use the page
> * passed in.
> + * in ocfs2_page_mkwirte() path, the page is already
> + * locked, don't lock it again.
> */
> - lock_page(mmap_page);
> + if (lockpg)
> + lock_page(mmap_page);
This block is only accessed when mmap_page is not NULL. Thus
the page must exist and must be locked (as stated above). You should
just BUG_ON(!PageLocked(mmap_page)) here.
Joel
--
"I think it would be a good idea."
- Mahatma Ghandi, when asked what he thought of Western
civilization
Joel Becker
Senior Development Manager
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
prev parent reply other threads:[~2010-11-17 23:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-05 4:53 [Ocfs2-devel] [PATCH] ocfs2: lock the page in __ocfs2_page_mkwrite() Wengang Wang
2010-11-15 2:12 ` Wengang Wang
2010-11-17 23:17 ` Joel Becker
2010-11-17 23:24 ` Sunil Mushran
2010-11-17 23:21 ` Joel Becker [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=20101117232149.GE25677@mail.oracle.com \
--to=joel.becker@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.