Don't WriteOut to readonly mounts
When the file closes, it attempts to write dirty cached attributes to the file. This should not be done when the mount is readonly. PiperOrigin-RevId: 315585058
This commit is contained in:
parent
0ae5bd24d7
commit
6722b1e56f
|
@ -640,7 +640,7 @@ func (i *inodeOperations) Allocate(ctx context.Context, inode *fs.Inode, offset,
|
||||||
|
|
||||||
// WriteOut implements fs.InodeOperations.WriteOut.
|
// WriteOut implements fs.InodeOperations.WriteOut.
|
||||||
func (i *inodeOperations) WriteOut(ctx context.Context, inode *fs.Inode) error {
|
func (i *inodeOperations) WriteOut(ctx context.Context, inode *fs.Inode) error {
|
||||||
if !i.session().cachePolicy.cacheUAttrs(inode) {
|
if inode.MountSource.Flags.ReadOnly || !i.session().cachePolicy.cacheUAttrs(inode) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,6 +368,9 @@ func (i *inodeOperations) Allocate(ctx context.Context, inode *fs.Inode, offset,
|
||||||
|
|
||||||
// WriteOut implements fs.InodeOperations.WriteOut.
|
// WriteOut implements fs.InodeOperations.WriteOut.
|
||||||
func (i *inodeOperations) WriteOut(ctx context.Context, inode *fs.Inode) error {
|
func (i *inodeOperations) WriteOut(ctx context.Context, inode *fs.Inode) error {
|
||||||
|
if inode.MountSource.Flags.ReadOnly {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
// Have we been using host kernel metadata caches?
|
// Have we been using host kernel metadata caches?
|
||||||
if !inode.MountSource.Flags.ForcePageCache || !canMap(inode) {
|
if !inode.MountSource.Flags.ForcePageCache || !canMap(inode) {
|
||||||
// Then the metadata is already up to date on the host.
|
// Then the metadata is already up to date on the host.
|
||||||
|
|
Loading…
Reference in New Issue