[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080430142543.ca3d5317.akpm@linux-foundation.org>
Date: Wed, 30 Apr 2008 14:25:43 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Erez Zadok <ezk@...sunysb.edu>
Cc: ezk@...sunysb.edu, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, viro@...iv.linux.org.uk,
hch@...radead.org, mhalcrow@...ibm.com, hugh@...itas.com
Subject: Re: [2.6.26 PATCH, RESEND]: fs_stack/eCryptfs: fsstack_copy_*
updates
On Wed, 30 Apr 2008 17:09:15 -0400
Erez Zadok <ezk@...sunysb.edu> wrote:
> In message <20080430101704.9cbd6384.akpm@...ux-foundation.org>, Andrew Morton writes:
> > On Mon, 21 Apr 2008 02:50:42 -0400
> > Erez Zadok <ezk@...sunysb.edu> wrote:
> [...]
> > Can we avoid having to think?
> >
> > void fsstack_copy_inode_size(struct inode *dst, const struct inode *src)
> > {
> > blkcnt_t i_blocks;
> > loff_t i_size;
> >
> > i_size = i_size_read(src);
> > spin_lock_32bit(&src->i_lock);
> > i_blocks = src->i_blocks;
> > spin_unlock_32bit(&src->i_lock);
> >
> > i_size_write(dst, i_size);
> > spin_lock_32bit(&dst->i_lock)
> > dst->i_blocks = i_blocks;
> > spin_unlock_32bit(&dst->i_lock)
> > }
>
> Thanks. I can't say that I'm an expert in these SMP issues. But I'll run
> your rewritten function through my 32 and 64-bit SMP and non-SMP systems,
> and see how it behaves.
>
The obvious risk here is that there's no synchronisation between the
copying of i_size and i_blocks. If that's a problem, I _expect_ that
i_mutex wold give pretty good coverage (but insufficient for
mmap-write-over-a-hole, I guess).
And someone needs to write spin_lock_32bit() ;)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists