[lkml]   [2008]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: fs_stack/eCryptfs: remove 3rd arg of copy_attr_all, add locking to copy_inode_size
    In message <>, "Josef 'Jeff' Sipek" writes:
    > On Wed, Apr 02, 2008 at 09:49:11PM -0400, Erez Zadok wrote:
    > ...
    > > +#if BITS_PER_LONG == 32 && defined(CONFIG_SMP)
    > > + spin_lock(&dst->i_lock);
    > > +#endif
    > I think you need to check CONFIG_PREEMPT as well.
    > Josef 'Jeff' Sipek.

    I'm not sure if it's needed in case of CONFIG_PREEMPT. Anyone? The code
    for i_size_write (below), and the comment at the top of the function,
    suggest that the spinlock is needed only to prevent the lots seqcount.

    * NOTE: unlike i_size_read(), i_size_write() does need locking around it
    * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
    * can be lost, resulting in subsequent i_size_read() calls spinning forever.
    static inline void i_size_write(struct inode *inode, loff_t i_size)
    #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
    inode->i_size = i_size;
    #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPT)
    inode->i_size = i_size;
    inode->i_size = i_size;

    BTW, some time ago I reviewed all callers of i_size_write. I did so again
    just now, and the results were the same:

    - a LOT of callers of i_size_write don't take any lock
    - some take another spinlock in a different data structure
    - those that do take the spinlock, do so unconditionally
    - only unionfs and fs/stack.c wrap the spinlock in

    #if BITS_PER_LONG == 32 && defined(CONFIG_SMP)


     \ /
      Last update: 2008-04-03 21:09    [W:0.019 / U:21.804 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site