[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <20080316152237.GB3542@webber.adilger.int>
Date: Sun, 16 Mar 2008 23:22:37 +0800
From: Andreas Dilger <adilger@....com>
To: Dmitri Monakhov <dmonakhov@...nvz.org>
Cc: linux-ext4@...r.kernel.org, Jens Axboe <jens.axboe@...cle.com>
Subject: Re: strange ext{3,4}_settattr logic
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@...3 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists