Re: [Patch] pipe: use file_update_time() when hold i_mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2009-07-22 at 17:21 +0800, Amerigo Wang wrote:
> Miklos Szeredi wrote:
> > On Tue, 2009-07-21 at 18:07 +0800, Amerigo Wang wrote:
> >   
> >> Andrew Morton wrote:
> >>     
> >>> On Mon, 6 Jul 2009 01:35:30 -0400
> >>> Amerigo Wang <amwang@xxxxxxxxxx> wrote:
> >>>
> >>>   
> >>>       
> >>>> file_update_time() should be called with i_mutex held,
> >>>> move it before mutex_unlock().
> >>>>
> >>>>     
> >>>>         
> >>> Why do you believe that file_update_time() needs i_mutex?
> >>>   
> >>>       
> >> file_update_time() modifies inode, no? :)
> >>     
> >
> > So does touch_atime(), yet neither needs i_mutex.
> >   
> Yes?
> 
> Then how the inode is protected when file_update_time() modifies
> it?

Protected against what?

For example the inode isn't protected against concurrent access by
stat(2), since that doesn't take i_mutex.

And indeed it looks like there are races there, since set/get operations
are not atomic on the timestamp, so stat could return a garbled value if
it races with file_update_time() or touch_atime().

Possibly worth fixing, but I'm not sure how to do that without affecting
the scalability of stat and friends and without adding too much
complexity.

Thanks,
Miklos

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux