#else
filp = dentry_open(dget(dp), mntget(afs_cacheMnt), O_RDWR);
#endif
- if (IS_ERR(filp))
- osi_Panic("Can't open file: %d\n", (int) PTR_ERR(filp));
+ if (IS_ERR(filp)) {
+ afs_warn("afs: Cannot open cache file (code %d). Trying to continue, "
+ "but AFS accesses may return errors or panic the system\n",
+ (int) PTR_ERR(filp));
+ filp = NULL;
+ }
dput(dp);
memset(afile, 0, sizeof(struct osi_file));
afile->filp = afs_linux_raw_open(ainode);
- afile->size = i_size_read(FILE_INODE(afile->filp));
+ if (afile->filp) {
+ afile->size = i_size_read(FILE_INODE(afile->filp));
+ }
AFS_GLOCK();
+
+ if (!afile->filp) {
+ osi_FreeLargeSpace(afile);
+ return NULL;
+ }
+
afile->offset = 0;
afile->proc = (int (*)())0;
return (void *)afile;
/* XXX - I suspect we should be locking the inodes before we use them! */
AFS_GUNLOCK();
cacheFp = afs_linux_raw_open(&tdc->f.inode);
+ osi_Assert(cacheFp);
if (!cacheFp->f_dentry->d_inode->i_mapping->a_ops->readpage) {
cachefs_noreadpage = 1;
AFS_GLOCK();
AFS_GUNLOCK();
if (tdc) {
cacheFp = afs_linux_raw_open(&tdc->f.inode);
+ osi_Assert(cacheFp);
if (!cacheFp->f_dentry->d_inode->i_mapping->a_ops->readpage) {
cachefs_noreadpage = 1;
goto out;
afs_AdjustSize(tdc, len);
tdc->validPos = len;
tfile = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(tfile);
afs_CFileWrite(tfile, 0, aname, len);
afs_CFileClose(tfile);
ReleaseWriteLock(&tdc->lock);
error = code;
ZapDCE(tdc); /* bad data */
cfile = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(cfile);
afs_CFileTruncate(cfile, 0);
afs_CFileClose(cfile);
afs_AdjustSize(tdc, 0); /* sets f.chunkSize to 0 */
return ENOENT; /* past the end */
}
tfile = afs_CFileOpen(&adc->f.inode);
+ osi_Assert(tfile);
code =
afs_CFileRead(tfile, tb->page * AFS_BUFFER_PAGESIZE, tb->data,
AFS_BUFFER_PAGESIZE);
if (lp->dirty) {
/* see DFlush for rationale for not getting and locking the dcache */
tfile = afs_CFileOpen(&lp->inode);
+ osi_Assert(tfile);
afs_CFileWrite(tfile, lp->page * AFS_BUFFER_PAGESIZE, lp->data,
AFS_BUFFER_PAGESIZE);
lp->dirty = 0;
struct osi_file *tfile;
tfile = afs_CFileOpen(&ab->inode);
+ osi_Assert(tfile);
afs_CFileWrite(tfile, ab->page * AFS_BUFFER_PAGESIZE,
ab->data, AFS_BUFFER_PAGESIZE);
ab->dirty = 0; /* Clear the dirty flag */
* Truncate the element to reclaim its space
*/
tfile = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(tfile);
afs_CFileTruncate(tfile, 0);
afs_CFileClose(tfile);
afs_AdjustSize(tdc, 0);
if ((lock & 2)) {
/* Truncate the chunk so zeroes get filled properly */
file = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(file);
afs_CFileTruncate(file, 0);
afs_CFileClose(file);
afs_AdjustSize(tdc, 0);
/* no data in file to read at this position */
UpgradeSToWLock(&tdc->lock, 607);
file = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(file);
afs_CFileTruncate(file, 0);
afs_CFileClose(file);
afs_AdjustSize(tdc, 0);
*/
DZap(tdc); /* pages in cache may be old */
file = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(file);
afs_RemoveVCB(&avc->f.fid);
tdc->f.states |= DWriting;
tdc->dflags |= DFFetching;
/* Open the files. */
tfile_src = afs_CFileOpen(&adc->f.inode);
tfile_dst = afs_CFileOpen(&new_dc->f.inode);
+ osi_Assert(tfile_src);
+ osi_Assert(tfile_dst);
/* And now copy dir dcache data into this dcache,
* 4k at a time.
}
ObtainReadLock(&tdc->lock);
tfile = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(tfile);
code = afs_CFileRead(tfile, 0, ttargetName, tlen);
ttargetName[tlen-1] = '\0';
afs_CFileClose(tfile);
size = tdc->f.chunkBytes;
tfile = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(tfile);
while ( size > 0 ) {
code = (*ops->prepare)(rock, size, &tlen);
if (code)
return code;
tfile = afs_CFileOpen(&volumeInode);
+ osi_Assert(tfile);
afs_CFileTruncate(tfile, 0);
afs_CFileClose(tfile);
return 0;
toAdd = AFS_CHUNKTOSIZE(tdc->f.chunk) - offset;
}
tfile = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(tfile);
while(tdc->validPos < avc->f.m.Length + toAdd) {
afs_size_t towrite;
UpgradeSToWLock(&tdc->lock, 673);
tdc->f.states |= DWriting;
tfile = afs_CFileOpen(&tdc->f.inode);
+ osi_Assert(tfile);
afs_CFileTruncate(tfile, (afs_int32)newSize);
afs_CFileClose(tfile);
afs_AdjustSize(tdc, (afs_int32)newSize);