public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Nick Piggin <npiggin@suse.de>,
	linux-kernel@vger.kernel.org
Subject: Re: mnt_want_write_file() has problem?
Date: Tue, 04 Aug 2009 03:48:34 +0900	[thread overview]
Message-ID: <8763d4ivi5.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <1249324312.26977.1336.camel@nimitz> (Dave Hansen's message of "Mon, 03 Aug 2009 11:31:52 -0700")

Dave Hansen <dave@linux.vnet.ibm.com> writes:

> On Mon, 2009-08-03 at 06:36 +0900, OGAWA Hirofumi wrote:
>> While I'm reading some code, I suspected that mnt_want_write_file() may
>> have wrong assumption.  I think mnt_want_write_file() is assuming it
>> increments ->mnt_writers if (file->f_mode & FMODE_WRITE). But, if it's
>> special_file(), it is false?
>> 
>> Sorry, I'm still not checking all of those though. E.g. I'm thinking the
>> below.
>> 
>> static inline int __get_file_write_access(struct inode *inode,
>> 					  struct vfsmount *mnt)
>> {
>> [...]
>> 	if (!special_file(inode->i_mode)) {
>> 		/*
>> 		 * Balanced in __fput()
>> 		 */
>> 		error = mnt_want_write(mnt);
>> 		if (error)
>> 			put_write_access(inode);
>> 	}
>> 	return error;
>> }
>
> In practice I don't think this is an issue.  We were never supposed to
> do mnt_want_write(mnt) for any 'struct file' that was a special_file(),
> specifically because of what you mention.
>
> Nick's use of mnt_want_write_file() was a 1:1 drop-in for
> mnt_want_write().  So, if all is well in the world, there should not be
> any call sites where mnt_want_write_file() gets called on a
> special_file().

void file_update_time(struct file *file)
sys_fchmod()
sys_fchown()
sys_fsetxattr()
sys_fremovexattr()

Um..., the users of mnt_want_write_file() seems to be those. I think
all of those filp can be special file?

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2009-08-03 18:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-02 21:36 mnt_want_write_file() has problem? OGAWA Hirofumi
2009-08-03 18:31 ` Dave Hansen
2009-08-03 18:48   ` OGAWA Hirofumi [this message]
2009-08-03 20:37     ` Dave Hansen
2009-08-04 19:15 ` Dave Hansen
2009-08-05  5:37   ` Nick Piggin
2009-09-12 13:39   ` Al Viro

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=8763d4ivi5.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=viro@zeniv.linux.org.uk \
    /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