Take write lock when removing xattr

PiperOrigin-RevId: 298380654
This commit is contained in:
Michael Pratt 2020-03-02 10:05:52 -08:00 committed by gVisor bot
parent 3d9ddeb339
commit 62bd3ca8a3
1 changed files with 2 additions and 2 deletions

View File

@ -259,8 +259,8 @@ func (i *InodeSimpleExtendedAttributes) ListXattr(context.Context, *fs.Inode, ui
// RemoveXattr implements fs.InodeOperations.RemoveXattr.
func (i *InodeSimpleExtendedAttributes) RemoveXattr(_ context.Context, _ *fs.Inode, name string) error {
i.mu.RLock()
defer i.mu.RUnlock()
i.mu.Lock()
defer i.mu.Unlock()
if _, ok := i.xattrs[name]; ok {
delete(i.xattrs, name)
return nil