mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Don't use read-only host FD for writable gofer dentries in VFS2.
As documented for gofer.dentry.hostFD. PiperOrigin-RevId: 329372319
This commit is contained in:
@@ -1472,8 +1472,9 @@ func (d *dentry) ensureSharedHandle(ctx context.Context, read, write, trunc bool
|
||||
return err
|
||||
}
|
||||
|
||||
if d.hostFD < 0 && openReadable && h.fd >= 0 {
|
||||
// We have no existing FD; use the new FD for at least reading.
|
||||
if d.hostFD < 0 && h.fd >= 0 && openReadable && (d.writeFile.isNil() || openWritable) {
|
||||
// We have no existing FD, and the new FD meets the requirements
|
||||
// for d.hostFD, so start using it.
|
||||
d.hostFD = h.fd
|
||||
} else if d.hostFD >= 0 && d.writeFile.isNil() && openWritable {
|
||||
// We have an existing read-only FD, but the file has just been
|
||||
|
||||
Reference in New Issue
Block a user