3 * Directory operations for Coda filesystem
4 * Original version: (C) 1996 P. Braam and M. Callahan
5 * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
7 * Carnegie Mellon encourages users to contribute improvements to
8 * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
11 #include <linux/types.h>
12 #include <linux/kernel.h>
13 #include <linux/sched.h>
15 #include <linux/stat.h>
16 #include <linux/errno.h>
17 #include <linux/locks.h>
18 #include <asm/segment.h>
19 #include <asm/uaccess.h>
20 #include <linux/string.h>
22 #include <linux/coda.h>
23 #include <linux/coda_linux.h>
24 #include <linux/coda_psdev.h>
25 #include <linux/coda_fs_i.h>
26 #include <linux/coda_cache.h>
27 #include <linux/coda_proc.h>
30 static int coda_create(struct inode
*dir
, struct dentry
*new, int mode
);
31 static int coda_mknod(struct inode
*dir
, struct dentry
*new, int mode
, int rdev
);
32 static struct dentry
*coda_lookup(struct inode
*dir
, struct dentry
*target
);
33 static int coda_link(struct dentry
*old_dentry
, struct inode
*dir_inode
,
34 struct dentry
*entry
);
35 static int coda_unlink(struct inode
*dir_inode
, struct dentry
*entry
);
36 static int coda_symlink(struct inode
*dir_inode
, struct dentry
*entry
,
38 static int coda_mkdir(struct inode
*dir_inode
, struct dentry
*entry
, int mode
);
39 static int coda_rmdir(struct inode
*dir_inode
, struct dentry
*entry
);
40 static int coda_rename(struct inode
*old_inode
, struct dentry
*old_dentry
,
41 struct inode
*new_inode
, struct dentry
*new_dentry
);
44 static int coda_readdir(struct file
*file
, void *dirent
, filldir_t filldir
);
47 static int coda_dentry_revalidate(struct dentry
*de
, int);
48 static void coda_dentry_delete(struct dentry
*);
50 /* support routines */
51 static int coda_venus_readdir(struct file
*filp
, void *dirent
,
53 int coda_fsync(struct file
*, struct dentry
*dentry
);
55 int coda_crossvol_rename
= 0;
56 int coda_hasmknod
= 0;
58 struct dentry_operations coda_dentry_operations
=
60 coda_dentry_revalidate
, /* revalidate */
63 coda_dentry_delete
/* delete */
66 struct inode_operations coda_dir_inode_operations
=
69 coda_create
, /* create */
70 coda_lookup
, /* lookup */
72 coda_unlink
, /* unlink */
73 coda_symlink
, /* symlink */
74 coda_mkdir
, /* mkdir */
75 coda_rmdir
, /* rmdir */
76 coda_mknod
, /* mknod */
77 coda_rename
, /* rename */
79 NULL
, /* follow_link */
85 coda_permission
, /* permission */
87 NULL
, /* update page */
88 coda_revalidate_inode
/* revalidate */
91 struct file_operations coda_dir_operations
= {
93 NULL
, /* read -- bad */
95 coda_readdir
, /* readdir */
101 coda_release
, /* release */
102 coda_fsync
, /* fsync */
109 /* inode operations for directories */
110 /* acces routines: lookup, readlink, permission */
111 static struct dentry
*coda_lookup(struct inode
*dir
, struct dentry
*entry
)
113 struct coda_inode_info
*dircnp
;
114 struct inode
*res_inode
= NULL
;
115 struct ViceFid resfid
;
116 int dropme
= 0; /* to indicate entry should not be cached */
119 const char *name
= entry
->d_name
.name
;
120 size_t length
= entry
->d_name
.len
;
126 if ( length
> CODA_MAXNAMLEN
) {
127 printk("name too long: lookup, %s (%*s)\n",
128 coda_f2s(&dircnp
->c_fid
), length
, name
);
129 return ERR_PTR(-ENAMETOOLONG
);
132 CDEBUG(D_INODE
, "name %s, len %d in ino %ld, fid %s\n",
133 name
, length
, dir
->i_ino
, coda_f2s(&dircnp
->c_fid
));
135 /* control object, create inode on the fly */
136 if (coda_isroot(dir
) && coda_iscontrol(name
, length
)) {
137 error
= coda_cnode_makectl(&res_inode
, dir
->i_sb
);
139 "Lookup on CTL object; dir ino %ld, count %d\n",
140 dir
->i_ino
, dir
->i_count
);
144 error
= venus_lookup(dir
->i_sb
, &(dircnp
->c_fid
),
145 (const char *)name
, length
, &type
, &resfid
);
149 if (type
& CODA_NOCACHE
) {
150 type
&= (~CODA_NOCACHE
);
151 CDEBUG(D_INODE
, "dropme set for %s\n",
155 error
= coda_cnode_make(&res_inode
, &resfid
, dir
->i_sb
);
157 return ERR_PTR(error
);
158 } else if (error
!= -ENOENT
) {
159 CDEBUG(D_INODE
, "error for %s(%*s)%d\n",
160 coda_f2s(&dircnp
->c_fid
), length
, name
, error
);
161 return ERR_PTR(error
);
163 CDEBUG(D_INODE
, "lookup: %s is (%s), type %d result %d, dropme %d\n",
164 name
, coda_f2s(&resfid
), type
, error
, dropme
);
168 entry
->d_op
= &coda_dentry_operations
;
169 d_add(entry
, res_inode
);
172 ITOC(res_inode
)->c_flags
|= C_VATTR
;
179 int coda_permission(struct inode
*inode
, int mask
)
181 struct coda_inode_info
*cp
= ITOC(inode
);
185 coda_vfs_stat
.permission
++;
186 coda_permission_stat
.count
++;
192 if ( coda_access_cache
== 1 ) {
193 if ( coda_cache_check(inode
, mask
) ) {
194 coda_permission_stat
.hit_count
++;
201 CDEBUG(D_INODE
, "mask is %o\n", mask
);
202 error
= venus_access(inode
->i_sb
, &(cp
->c_fid
), mask
);
204 CDEBUG(D_INODE
, "fid: %s, ino: %ld (mask: %o) error: %d\n",
205 coda_f2s(&(cp
->c_fid
)), inode
->i_ino
, mask
, error
);
208 coda_cache_enter(inode
, mask
);
216 /* creation routines: create, mknod, mkdir, link, symlink */
218 static int coda_create(struct inode
*dir
, struct dentry
*de
, int mode
)
221 struct coda_inode_info
*dircnp
;
222 const char *name
=de
->d_name
.name
;
223 int length
=de
->d_name
.len
;
224 struct inode
*result
= NULL
;
225 struct ViceFid newfid
;
226 struct coda_vattr attrs
;
229 coda_vfs_stat
.create
++;
231 CDEBUG(D_INODE
, "name: %s, length %d, mode %o\n",name
, length
, mode
);
233 if (coda_isroot(dir
) && coda_iscontrol(name
, length
))
238 error
= venus_create(dir
->i_sb
, &(dircnp
->c_fid
), name
, length
,
239 0, mode
, 0, &newfid
, &attrs
);
242 CDEBUG(D_INODE
, "create: %s, result %d\n",
243 coda_f2s(&newfid
), error
);
248 error
= coda_cnode_make(&result
, &newfid
, dir
->i_sb
);
255 /* invalidate the directory cnode's attributes */
256 dircnp
->c_flags
|= C_VATTR
;
257 d_instantiate(de
, result
);
261 static int coda_mknod(struct inode
*dir
, struct dentry
*de
, int mode
, int rdev
)
264 struct coda_inode_info
*dircnp
;
265 const char *name
=de
->d_name
.name
;
266 int length
=de
->d_name
.len
;
267 struct inode
*result
= NULL
;
268 struct ViceFid newfid
;
269 struct coda_vattr attrs
;
271 if ( coda_hasmknod
== 0 )
274 coda_vfs_stat
.create
++;
276 CDEBUG(D_INODE
, "name: %s, length %d, mode %o, rdev %x\n",name
, length
, mode
, rdev
);
278 if (coda_isroot(dir
) && coda_iscontrol(name
, length
))
283 error
= venus_create(dir
->i_sb
, &(dircnp
->c_fid
), name
, length
,
284 0, mode
, rdev
, &newfid
, &attrs
);
287 CDEBUG(D_INODE
, "mknod: %s, result %d\n",
288 coda_f2s(&newfid
), error
);
293 error
= coda_cnode_make(&result
, &newfid
, dir
->i_sb
);
300 /* invalidate the directory cnode's attributes */
301 dircnp
->c_flags
|= C_VATTR
;
302 d_instantiate(de
, result
);
306 static int coda_mkdir(struct inode
*dir
, struct dentry
*de
, int mode
)
308 struct coda_inode_info
*dircnp
;
310 struct coda_vattr attr
;
311 const char *name
= de
->d_name
.name
;
312 int len
= de
->d_name
.len
;
314 struct ViceFid newfid
;
317 coda_vfs_stat
.mkdir
++;
319 if (coda_isroot(dir
) && coda_iscontrol(name
, len
))
324 CDEBUG(D_INODE
, "mkdir %s (len %d) in %s, mode %o.\n",
325 name
, len
, coda_f2s(&(dircnp
->c_fid
)), mode
);
328 error
= venus_mkdir(dir
->i_sb
, &(dircnp
->c_fid
),
329 name
, len
, &newfid
, &attr
);
332 CDEBUG(D_INODE
, "mkdir error: %s result %d\n",
333 coda_f2s(&newfid
), error
);
338 CDEBUG(D_INODE
, "mkdir: new dir has fid %s.\n",
341 error
= coda_cnode_make(&inode
, &newfid
, dir
->i_sb
);
347 /* invalidate the directory cnode's attributes */
348 dircnp
->c_flags
|= C_VATTR
;
350 d_instantiate(de
, inode
);
354 /* try to make de an entry in dir_inodde linked to source_de */
355 static int coda_link(struct dentry
*source_de
, struct inode
*dir_inode
,
358 struct inode
*inode
= source_de
->d_inode
;
359 const char * name
= de
->d_name
.name
;
360 int len
= de
->d_name
.len
;
361 struct coda_inode_info
*dir_cnp
, *cnp
;
365 coda_vfs_stat
.link
++;
367 if (coda_isroot(dir_inode
) && coda_iscontrol(name
, len
))
370 dir_cnp
= ITOC(dir_inode
);
373 CDEBUG(D_INODE
, "old: fid: %s\n", coda_f2s(&(cnp
->c_fid
)));
374 CDEBUG(D_INODE
, "directory: %s\n", coda_f2s(&(dir_cnp
->c_fid
)));
376 error
= venus_link(dir_inode
->i_sb
,&(cnp
->c_fid
), &(dir_cnp
->c_fid
),
377 (const char *)name
, len
);
380 dir_cnp
->c_flags
|= C_VATTR
;
382 d_instantiate(de
, inode
);
389 CDEBUG(D_INODE
, "link result %d\n",error
);
395 static int coda_symlink(struct inode
*dir_inode
, struct dentry
*de
,
398 const char *name
= de
->d_name
.name
;
399 int len
= de
->d_name
.len
;
400 struct coda_inode_info
*dir_cnp
= ITOC(dir_inode
);
405 coda_vfs_stat
.symlink
++;
407 if (coda_isroot(dir_inode
) && coda_iscontrol(name
, len
))
410 symlen
= strlen(symname
);
411 if ( symlen
> CODA_MAXPATHLEN
)
412 return -ENAMETOOLONG
;
414 CDEBUG(D_INODE
, "symname: %s, length: %d\n", symname
, symlen
);
417 * This entry is now negative. Since we do not create
418 * an inode for the entry we have to drop it.
421 error
= venus_symlink(dir_inode
->i_sb
, &(dir_cnp
->c_fid
), name
, len
,
424 /* mtime is no good anymore */
426 dir_cnp
->c_flags
|= C_VATTR
;
429 CDEBUG(D_INODE
, "in symlink result %d\n",error
);
434 /* destruction routines: unlink, rmdir */
435 int coda_unlink(struct inode
*dir
, struct dentry
*de
)
437 struct coda_inode_info
*dircnp
= ITOC(dir
);
439 const char *name
= de
->d_name
.name
;
440 int len
= de
->d_name
.len
;
443 coda_vfs_stat
.unlink
++;
445 CDEBUG(D_INODE
, " %s in %s, dirino %ld\n", name
,
446 coda_f2s(&(dircnp
->c_fid
)), dir
->i_ino
);
448 error
= venus_remove(dir
->i_sb
, &(dircnp
->c_fid
), name
, len
);
450 CDEBUG(D_INODE
, "upc returned error %d\n", error
);
454 /* cache management: mtime has changed, ask Venus */
455 dircnp
->c_flags
|= C_VATTR
;
456 de
->d_inode
->i_nlink
--;
462 int coda_rmdir(struct inode
*dir
, struct dentry
*de
)
464 struct coda_inode_info
*dircnp
;
465 const char *name
= de
->d_name
.name
;
466 int len
= de
->d_name
.len
;
470 coda_vfs_stat
.rmdir
++;
474 if (!list_empty(&de
->d_hash
))
476 error
= venus_rmdir(dir
->i_sb
, &(dircnp
->c_fid
), name
, len
);
479 CDEBUG(D_INODE
, "upc returned error %d\n", error
);
483 if (de
->d_inode
->i_nlink
)
484 de
->d_inode
->i_nlink
--;
490 static int coda_rename(struct inode
*old_dir
, struct dentry
*old_dentry
,
491 struct inode
*new_dir
, struct dentry
*new_dentry
)
493 const char *old_name
= old_dentry
->d_name
.name
;
494 const char *new_name
= new_dentry
->d_name
.name
;
495 int old_length
= old_dentry
->d_name
.len
;
496 int new_length
= new_dentry
->d_name
.len
;
497 struct inode
*new_inode
= new_dentry
->d_inode
;
498 struct coda_inode_info
*new_cnp
, *old_cnp
;
502 coda_vfs_stat
.rename
++;
504 old_cnp
= ITOC(old_dir
);
505 new_cnp
= ITOC(new_dir
);
507 CDEBUG(D_INODE
, "old: %s, (%d length, %d strlen), new: %s"
508 "(%d length, %d strlen).old:d_count: %d, new:d_count: %d\n",
509 old_name
, old_length
, strlen(old_name
), new_name
, new_length
,
510 strlen(new_name
),old_dentry
->d_count
, new_dentry
->d_count
);
512 /* the C library will do unlink/create etc */
513 if ( coda_crossvol_rename
== 0 &&
514 old_cnp
->c_fid
.Volume
!= new_cnp
->c_fid
.Volume
)
517 error
= venus_rename(old_dir
->i_sb
, &(old_cnp
->c_fid
),
518 &(new_cnp
->c_fid
), old_length
, new_length
,
519 (const char *) old_name
, (const char *)new_name
);
522 CDEBUG(D_INODE
, "returned error %d\n", error
);
526 coda_flag_inode(new_inode
, C_VATTR
);
527 coda_flag_inode(old_dir
, C_VATTR
);
528 coda_flag_inode(new_dir
, C_VATTR
);
530 CDEBUG(D_INODE
, "result %d\n", error
);
538 /* file operations for directories */
539 int coda_readdir(struct file
*file
, void *dirent
, filldir_t filldir
)
542 struct coda_inode_info
*cnp
;
543 struct file open_file
;
544 struct dentry open_dentry
;
545 struct inode
*inode
=file
->f_dentry
->d_inode
;
548 coda_vfs_stat
.readdir
++;
552 CDEBUG(D_FILE
, "open inode pointer = NULL.\n");
556 coda_prepare_openfile(inode
, file
, cnp
->c_ovp
, &open_file
,
558 if ( S_ISREG(cnp
->c_ovp
->i_mode
) ) {
559 /* Venus: we must read Venus dirents from the file */
560 result
= coda_venus_readdir(&open_file
, dirent
, filldir
);
562 /* potemkin case: we are handed a directory inode */
563 down(&cnp
->c_ovp
->i_sem
);
564 result
= open_file
.f_op
->readdir(&open_file
, dirent
, filldir
);
565 up(&cnp
->c_ovp
->i_sem
);
567 coda_restore_codafile(inode
, file
, cnp
->c_ovp
, &open_file
);
572 /* ask venus to cache the file and return the inode of the container file,
573 put this inode pointer in the cnode for future read/writes */
574 int coda_open(struct inode
*i
, struct file
*f
)
578 struct coda_inode_info
*cnp
;
580 struct inode
*cont_inode
= NULL
;
581 unsigned short flags
= f
->f_flags
& (~O_EXCL
);
582 unsigned short coda_flags
= coda_flags_to_cflags(flags
);
583 struct coda_cred
*cred
;
586 coda_vfs_stat
.open
++;
588 CDEBUG(D_SPECIAL
, "OPEN inode number: %ld, count %d, flags %o.\n",
589 f
->f_dentry
->d_inode
->i_ino
, f
->f_dentry
->d_count
, flags
);
594 error
= venus_open(i
->i_sb
, &(cnp
->c_fid
), coda_flags
, &ino
, &dev
);
596 CDEBUG(D_FILE
, "venus: dev %d, inode %ld, out->result %d\n",
601 /* coda_upcall returns ino number of cached object, get inode */
602 CDEBUG(D_FILE
, "cache file dev %d, ino %ld\n", dev
, ino
);
603 error
= coda_inode_grab(dev
, ino
, &cont_inode
);
605 if ( error
|| !cont_inode
){
606 printk("coda_open: coda_inode_grab error %d.", error
);
612 CODA_ALLOC(cred
, struct coda_cred
*, sizeof(*cred
));
613 coda_load_creds(cred
);
614 f
->private_data
= cred
;
620 cnp
->c_ovp
= cont_inode
;
623 CDEBUG(D_FILE
, "result %d, coda i->i_count is %d for ino %ld\n",
624 error
, i
->i_count
, i
->i_ino
);
625 CDEBUG(D_FILE
, "cache ino: %ld, count %d, ops %x\n",
626 cnp
->c_ovp
->i_ino
, cnp
->c_ovp
->i_count
,
627 (int)(cnp
->c_ovp
->i_op
));
632 int coda_release(struct inode
*i
, struct file
*f
)
634 struct coda_inode_info
*cnp
;
636 unsigned short flags
= (f
->f_flags
) & (~O_EXCL
);
637 unsigned short cflags
= coda_flags_to_cflags(flags
);
638 struct coda_cred
*cred
;
641 coda_vfs_stat
.release
++;
643 cred
= (struct coda_cred
*)f
->private_data
;
648 "RELEASE coda (ino %ld, ct %d) cache (ino %ld, ct %d)\n",
649 i
->i_ino
, i
->i_count
, (cnp
->c_ovp
? cnp
->c_ovp
->i_ino
: 0),
650 (cnp
->c_ovp
? cnp
->c_ovp
->i_count
: -99));
653 /* even when c_ocount=0 we cannot put c_ovp to
654 * NULL since the file may be mmapped.
655 * See code in inode.c (coda_put_inode) for
656 * further handling of close.
661 if (flags
& (O_WRONLY
| O_RDWR
)) {
665 error
= venus_release(i
->i_sb
, &(cnp
->c_fid
), cflags
, cred
);
667 CODA_FREE(cred
, sizeof(*cred
));
668 f
->private_data
= NULL
;
670 CDEBUG(D_FILE
, "coda_release: result: %d\n", error
);
674 /* support routines */
676 * this structure is manipulated by filldir in vfs layer.
677 * the count holds the remaining amount of space in the getdents buffer,
678 * beyond the current_dir pointer.
682 /* should be big enough to hold any single directory entry */
683 #define DIR_BUFSIZE 2048
685 static int coda_venus_readdir(struct file
*filp
, void *getdent
,
689 int offset
= filp
->f_pos
; /* offset in the directory file */
691 int pos
= 0; /* offset in the block we read */
692 int result
= 0; /* either an error or # of entries returned */
695 struct venus_dirent
*vdirent
;
696 int string_offset
= (int) (&((struct venus_dirent
*)(0))->d_name
);
701 CODA_ALLOC(buff
, char *, DIR_BUFSIZE
);
703 printk("coda_venus_readdir: out of memory.\n");
707 /* we use this routine to read the file into our buffer */
708 bufsize
= read_exec(filp
->f_dentry
, filp
->f_pos
, buff
, DIR_BUFSIZE
, 1);
710 printk("coda_venus_readdir: cannot read directory %d.\n",
720 /* Parse and write into user space. Filldir tells us when done! */
721 CDEBUG(D_FILE
, "buffsize: %d offset %d, count %d.\n",
722 bufsize
, offset
, count
);
726 while ( pos
+ string_offset
< bufsize
&& i
< 1024) {
727 vdirent
= (struct venus_dirent
*) (buff
+ pos
);
729 /* test if the name is fully in the buffer */
730 if ( pos
+ string_offset
+ (int) vdirent
->d_namlen
>= bufsize
){
732 printk("CODA: Invalid directory cfino: %ld\n",
733 filp
->f_dentry
->d_inode
->i_ino
);
736 /* now we are certain that we can read the entry from buff */
738 /* if we don't have a null entry, copy it */
739 if ( vdirent
->d_fileno
&& vdirent
->d_reclen
) {
740 int namlen
= vdirent
->d_namlen
;
741 off_t offs
= filp
->f_pos
;
742 ino_t ino
= vdirent
->d_fileno
;
743 char *name
= vdirent
->d_name
;
745 errfill
= filldir(getdent
, name
, namlen
,
747 CDEBUG(D_FILE
, "entry %d: ino %ld, namlen %d, reclen %d, type %d, pos %d, string_offs %d, name %*s, offset %d, result: %d, errfill: %d.\n", i
,vdirent
->d_fileno
, vdirent
->d_namlen
, vdirent
->d_reclen
, vdirent
->d_type
, pos
, string_offset
, vdirent
->d_namlen
, vdirent
->d_name
, (u_int
) offs
, result
, errfill
);
748 /* errfill means no space for filling in this round */
757 filp
->f_pos
+= vdirent
->d_reclen
;
758 if ( filp
->f_pos
> filp
->f_dentry
->d_inode
->i_size
)
760 if ( !vdirent
->d_reclen
) {
761 printk("CODA: Invalid directory, cfino: %ld\n",
762 filp
->f_dentry
->d_inode
->i_ino
);
766 pos
+= (unsigned int) vdirent
->d_reclen
;
771 printk("Repeating too much in readdir %ld\n",
772 filp
->f_dentry
->d_inode
->i_ino
);
777 CODA_FREE(buff
, DIR_BUFSIZE
);
781 /* called when a cache lookup succeeds */
782 static int coda_dentry_revalidate(struct dentry
*de
, int flags
)
785 struct inode
*inode
= de
->d_inode
;
786 struct coda_inode_info
*cii
;
792 cii
= ITOC(de
->d_inode
);
793 if (coda_isroot(inode
))
795 if (is_bad_inode(inode
))
798 if (! (cii
->c_flags
& (C_PURGE
| C_FLUSH
)) )
801 shrink_dcache_parent(de
);
803 /* propagate for a flush */
804 if (cii
->c_flags
& C_FLUSH
)
805 coda_flag_inode_children(inode
, C_FLUSH
);
807 if (de
->d_count
> 1) {
808 /* pretend it's valid, but don't change the flags */
809 CDEBUG(D_DOWNCALL
, "BOOM for: ino %ld, %s\n",
810 de
->d_inode
->i_ino
, coda_f2s(&cii
->c_fid
));
814 /* clear the flags. */
815 cii
->c_flags
&= ~(C_VATTR
| C_PURGE
| C_FLUSH
);
821 * This is the callback from dput() when d_count is going to 0.
822 * We use this to unhash dentries with bad inodes.
824 static void coda_dentry_delete(struct dentry
* dentry
)
828 if (!dentry
->d_inode
)
831 flags
= (ITOC(dentry
->d_inode
)->c_flags
) & C_PURGE
;
832 if (is_bad_inode(dentry
->d_inode
) || flags
) {
833 CDEBUG(D_DOWNCALL
, "bad inode, unhashing %s/%s, %ld\n",
834 dentry
->d_parent
->d_name
.name
, dentry
->d_name
.name
,
835 dentry
->d_inode
->i_ino
);
843 * This is called when we want to check if the inode has
844 * changed on the server. Coda makes this easy since the
845 * cache manager Venus issues a downcall to the kernel when this
849 int coda_revalidate_inode(struct dentry
*dentry
)
851 struct coda_vattr attr
;
855 struct inode
*inode
= dentry
->d_inode
;
856 struct coda_inode_info
*cii
= ITOC(inode
);
859 CDEBUG(D_INODE
, "revalidating: %*s/%*s\n",
860 dentry
->d_name
.len
, dentry
->d_name
.name
,
861 dentry
->d_parent
->d_name
.len
, dentry
->d_parent
->d_name
.name
);
863 if ( cii
->c_flags
== 0 )
866 /* Venus closed the device .... */
867 if ( cii
->c_flags
& C_DYING
) {
868 make_bad_inode(inode
);
873 if (cii
->c_flags
& (C_VATTR
| C_PURGE
| C_FLUSH
)) {
874 error
= venus_getattr(inode
->i_sb
, &(cii
->c_fid
), &attr
);
876 make_bad_inode(inode
);
880 /* this inode may be lost if:
882 - type changes must be permitted for repair and
883 missing mount points.
885 old_mode
= inode
->i_mode
;
886 old_ino
= inode
->i_ino
;
887 coda_vattr_to_iattr(inode
, &attr
);
890 if ((old_mode
& S_IFMT
) != (inode
->i_mode
& S_IFMT
)) {
891 printk("Coda: inode %ld, fid %s changed type!\n",
892 inode
->i_ino
, coda_f2s(&(cii
->c_fid
)));
895 /* the following can happen when a local fid is replaced
896 with a global one, here we lose and declar the inode bad */
897 if (inode
->i_ino
!= old_ino
) {
898 make_bad_inode(inode
);
899 inode
->i_mode
= old_mode
;
904 coda_flag_inode_children(inode
, C_FLUSH
);
906 cii
->c_flags
&= ~(C_VATTR
| C_PURGE
| C_FLUSH
);