#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);
#if defined(AFS_LINUX26_ENV) && defined(STRUCT_FILE_OPERATIONS_HAS_SENDFILE)
.sendfile = generic_file_sendfile,
#endif
+#if defined(AFS_LINUX26_ENV) && defined(STRUCT_FILE_OPERATIONS_HAS_SPLICE)
+ .splice_write = generic_file_splice_write,
+ .splice_read = generic_file_splice_read,
+#endif
.release = afs_linux_release,
.fsync = afs_linux_fsync,
.lock = afs_linux_lock,
afs_getattr(vcp, &vattr, credp);
afs_fill_inode(ip, &vattr);
+ insert_inode_hash(ip);
dp->d_op = &afs_dentry_operations;
dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion);
d_instantiate(dp, ip);
ip = AFSTOV(vcp);
afs_getattr(vcp, &vattr, credp);
afs_fill_inode(ip, &vattr);
+ if (hlist_unhashed(&ip->i_hash))
+ insert_inode_hash(ip);
}
dp->d_op = &afs_dentry_operations;
dp->d_time = hgetlo(VTOAFS(dip)->m.DataVersion);
#endif
}
- /* insert_inode_hash(ip); -- this would make iget() work (if we used it) */
}