DEVEL15-linux-dont-flush-writes-on-exec-20080326

LICENSE IPL10
FIXES 17509

because of when fds are NULL'd in file_table this should work except when one process has the same file open for read and for write in different FDs; otherwise,
 the last write fd to close collects the error.


(cherry picked from commit 1cf6c12a07)
This commit is contained in:
Chas Williams 2008-03-26 04:17:18 +00:00 committed by Derrick Brashear
parent f64f192d63
commit f5e8415f16

View File

@ -582,18 +582,24 @@ afs_linux_flush(struct file *fp)
#endif
{
struct vrequest treq;
struct vcache *vcp = VTOAFS(FILE_INODE(fp));
cred_t *credp = crref();
struct vcache *vcp;
cred_t *credp;
int code;
AFS_GLOCK();
if (fp->f_flags | O_RDONLY) /* readers dont flush */
return 0;
credp = crref();
vcp = VTOAFS(FILE_INODE(fp));
code = afs_InitReq(&treq, credp);
if (code)
goto out;
ObtainSharedLock(&vcp->lock, 535);
if (vcp->execsOrWriters > 0) {
if ((vcp->execsOrWriters > 0) && (file_count(fp) == 1)) {
UpgradeSToWLock(&vcp->lock, 536);
code = afs_StoreAllSegments(vcp, &treq, AFS_SYNC | AFS_LASTSTORE);
ConvertWToSLock(&vcp->lock);