From: Andreas Dilger <adilger@sun.com>
To: Dmitri Monakhov <dmonakhov@openvz.org>
Cc: linux-ext4@vger.kernel.org, Jens Axboe <jens.axboe@oracle.com>
Subject: Re: strange ext{3,4}_settattr logic
Date: Sun, 16 Mar 2008 23:22:37 +0800 [thread overview]
Message-ID: <20080316152237.GB3542@webber.adilger.int> (raw)
In-Reply-To: <20080316113912.GA3118@dmon-lap.sw.ru>
On Mar 16, 2008 14:39 +0300, Dmitri Monakhov wrote:
> > --- linux-2.6.24/fs/namei.c.orig 2008-02-05 07:29:57.000000000 +0800
> > +++ linux-2.6.24/fs/namei.c 2008-03-16 08:11:41.000000000 +0800
> > @@ -233,6 +233,10 @@ int permission(struct inode *inode, int
> > if (nd)
> > mnt = nd->mnt;
> >
> > + /* Don't allow direct read, write, or truncate on a swapfile */
>
> Your patch disallow expand truncates (#2) which is definitely not good.
How often is that done though? Since this is only for a swapfile then
it isn't needed.
> In fact if file was opened before S_SWAPFILE flag was setted when it is
> possible to directly read, write from file.
I assume that is even a more rare case. I was thinking alternately to
do a "deny_write" on the swapfile during swapon() so that this would
fail in more cases.
> > + if (IS_SWAPFILE(inode))
> > + return -ETXTBUSY;
> > +
> > if (mask & MAY_WRITE) {
> > umode_t mode = inode->i_mode;
>
> BTW it is impossible to disable swapfile with your patch
> [root@ts63 tmp]# swapoff /vz/swap
> swapoff: /vz/swap: Text file busy
I thought some bug like this might appear.
> IMHO S_SWAPFILE flag must be checked in ext3_setattr, see patch attached:
No, that still means every other filesystem is broken. Since the current
filesystem code doesn't know anything about IS_SWAPFILE I'd rather keep
it that way. I think it is better to move my proposed IS_SWAPFILE() check
into "MAY_WRITE" and "MAY_EXEC" cases.
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
next prev parent reply other threads:[~2008-03-16 15:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-15 16:07 strange ext{3,4}_settattr logic Dmitri Monakhov
2008-03-15 23:05 ` Andreas Dilger
2008-03-15 23:54 ` Andreas Dilger
2008-03-16 0:23 ` Andreas Dilger
2008-03-16 11:39 ` Dmitri Monakhov
2008-03-16 15:22 ` Andreas Dilger [this message]
2008-03-16 17:48 ` Dmitri Monakhov
2008-03-17 8:24 ` Jens Axboe
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=20080316152237.GB3542@webber.adilger.int \
--to=adilger@sun.com \
--cc=dmonakhov@openvz.org \
--cc=jens.axboe@oracle.com \
--cc=linux-ext4@vger.kernel.org \
/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