mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix deadlock in specialFileFD.pwrite
When file is regular and metadata cache is authoritative, metadata lock is taken. The code deadlocks trying to acquire the metadata lock again to update time stampts. PiperOrigin-RevId: 354584594
This commit is contained in:
committed by
gVisor bot
parent
25284ae3c9
commit
0fa534f116
@@ -299,10 +299,15 @@ func (fd *specialFileFD) pwrite(ctx context.Context, src usermem.IOSequence, off
|
||||
src = src.TakeFirst64(limit)
|
||||
}
|
||||
|
||||
// Do a buffered write. See rationale in PRead.
|
||||
if d.cachedMetadataAuthoritative() {
|
||||
d.touchCMtime()
|
||||
if fd.isRegularFile {
|
||||
d.touchCMtimeLocked()
|
||||
} else {
|
||||
d.touchCMtime()
|
||||
}
|
||||
}
|
||||
|
||||
// Do a buffered write. See rationale in PRead.
|
||||
buf := make([]byte, src.NumBytes())
|
||||
copied, copyErr := src.CopyIn(ctx, buf)
|
||||
if copied == 0 && copyErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user