From: Andrew Morton <akpm@linux-foundation.org>
To: Erez Zadok <ezk@cs.sunysb.edu>
Cc: ezk@cs.sunysb.edu, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk,
hch@infradead.org, mhalcrow@us.ibm.com, hugh@veritas.com
Subject: Re: [2.6.26 PATCH, RESEND]: fs_stack/eCryptfs: fsstack_copy_* updates
Date: Wed, 30 Apr 2008 14:25:43 -0700 [thread overview]
Message-ID: <20080430142543.ca3d5317.akpm@linux-foundation.org> (raw)
In-Reply-To: <200804302109.m3UL9FBj031457@agora.fsl.cs.sunysb.edu>
On Wed, 30 Apr 2008 17:09:15 -0400
Erez Zadok <ezk@cs.sunysb.edu> wrote:
> In message <20080430101704.9cbd6384.akpm@linux-foundation.org>, Andrew Morton writes:
> > On Mon, 21 Apr 2008 02:50:42 -0400
> > Erez Zadok <ezk@cs.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() ;)
next prev parent reply other threads:[~2008-04-30 21:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 6:50 [2.6.26 PATCH, RESEND]: fs_stack/eCryptfs: fsstack_copy_* updates Erez Zadok
2008-04-30 17:17 ` Andrew Morton
2008-04-30 21:09 ` Erez Zadok
2008-04-30 21:25 ` Andrew Morton [this message]
2008-05-01 17:18 ` Erez Zadok
2008-05-01 19:21 ` Andrew Morton
2008-05-01 23:44 ` Erez Zadok
2008-05-02 0:08 ` Andrew Morton
2008-05-02 5:58 ` Erez Zadok
2008-05-02 6:11 ` Andrew Morton
2008-05-12 0:44 ` hooanon05
2008-05-02 13:17 ` Hugh Dickins
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=20080430142543.ca3d5317.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ezk@cs.sunysb.edu \
--cc=hch@infradead.org \
--cc=hugh@veritas.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhalcrow@us.ibm.com \
--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;
as well as URLs for NNTP newsgroup(s).