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 */
84 coda_permission
, /* permission */
86 NULL
, /* update page */
87 coda_revalidate_inode
/* revalidate */
90 struct file_operations coda_dir_operations
= {
92 NULL
, /* read -- bad */
94 coda_readdir
, /* readdir */
100 coda_release
, /* release */
101 coda_fsync
, /* fsync */
108 /* inode operations for directories */
109 /* acces routines: lookup, readlink, permission */
110 static struct dentry
*coda_lookup(struct inode
*dir
, struct dentry
*entry
)
112 struct coda_inode_info
*dircnp
;
113 struct inode
*res_inode
= NULL
;
114 struct ViceFid resfid
;
115 int dropme
= 0; /* to indicate entry should not be cached */
118 const char *name
= entry
->d_name
.name
;
119 size_t length
= entry
->d_name
.len
;
125 if ( length
> CODA_MAXNAMLEN
) {
126 printk("name too long: lookup, %s (%*s)\n",
127 coda_f2s(&dircnp
->c_fid
), length
, name
);
128 return ERR_PTR(-ENAMETOOLONG
);
131 CDEBUG(D_INODE
, "name %s, len %d in ino %ld, fid %s\n",
132 name
, length
, dir
->i_ino
, coda_f2s(&dircnp
->c_fid
));
134 /* control object, create inode on the fly */
135 if (coda_isroot(dir
) && coda_iscontrol(name
, length
)) {
136 error
= coda_cnode_makectl(&res_inode
, dir
->i_sb
);
138 "Lookup on CTL object; dir ino %ld, count %d\n",
139 dir
->i_ino
, dir
->i_count
);
143 error
= venus_lookup(dir
->i_sb
, &(dircnp
->c_fid
),
144 (const char *)name
, length
, &type
, &resfid
);
148 if (type
& CODA_NOCACHE
) {
149 type
&= (~CODA_NOCACHE
);
150 CDEBUG(D_INODE
, "dropme set for %s\n",
154 error
= coda_cnode_make(&res_inode
, &resfid
, dir
->i_sb
);
156 return ERR_PTR(error
);
157 } else if (error
!= -ENOENT
) {
158 CDEBUG(D_INODE
, "error for %s(%*s)%d\n",
159 coda_f2s(&dircnp
->c_fid
), length
, name
, error
);
160 return ERR_PTR(error
);
162 CDEBUG(D_INODE
, "lookup: %s is (%s), type %d result %d, dropme %d\n",
163 name
, coda_f2s(&resfid
), type
, error
, dropme
);
167 entry
->d_op
= &coda_dentry_operations
;
168 d_add(entry
, res_inode
);
171 ITOC(res_inode
)->c_flags
|= C_VATTR
;
178 int coda_permission(struct inode
*inode
, int mask
)
180 struct coda_inode_info
*cp
= ITOC(inode
);
184 coda_vfs_stat
.permission
++;
185 coda_permission_stat
.count
++;
191 if ( coda_access_cache
== 1 ) {
192 if ( coda_cache_check(inode
, mask
) ) {
193 coda_permission_stat
.hit_count
++;
200 CDEBUG(D_INODE
, "mask is %o\n", mask
);
201 error
= venus_access(inode
->i_sb
, &(cp
->c_fid
), mask
);
203 CDEBUG(D_INODE
, "fid: %s, ino: %ld (mask: %o) error: %d\n",
204 coda_f2s(&(cp
->c_fid
)), inode
->i_ino
, mask
, error
);
207 coda_cache_enter(inode
, mask
);
215 /* creation routines: create, mknod, mkdir, link, symlink */
217 static int coda_create(struct inode
*dir
, struct dentry
*de
, int mode
)
220 struct coda_inode_info
*dircnp
;
221 const char *name
=de
->d_name
.name
;
222 int length
=de
->d_name
.len
;
223 struct inode
*result
= NULL
;
224 struct ViceFid newfid
;
225 struct coda_vattr attrs
;
228 coda_vfs_stat
.create
++;
230 CDEBUG(D_INODE
, "name: %s, length %d, mode %o\n",name
, length
, mode
);
232 if (coda_isroot(dir
) && coda_iscontrol(name
, length
))
237 error
= venus_create(dir
->i_sb
, &(dircnp
->c_fid
), name
, length
,
238 0, mode
, 0, &newfid
, &attrs
);
241 CDEBUG(D_INODE
, "create: %s, result %d\n",
242 coda_f2s(&newfid
), error
);
247 error
= coda_cnode_make(&result
, &newfid
, dir
->i_sb
);
254 /* invalidate the directory cnode's attributes */
255 dircnp
->c_flags
|= C_VATTR
;
256 d_instantiate(de
, result
);
260 static int coda_mknod(struct inode
*dir
, struct dentry
*de
, int mode
, int rdev
)
263 struct coda_inode_info
*dircnp
;
264 const char *name
=de
->d_name
.name
;
265 int length
=de
->d_name
.len
;
266 struct inode
*result
= NULL
;
267 struct ViceFid newfid
;
268 struct coda_vattr attrs
;
270 if ( coda_hasmknod
== 0 )
273 coda_vfs_stat
.create
++;
275 CDEBUG(D_INODE
, "name: %s, length %d, mode %o, rdev %x\n",name
, length
, mode
, rdev
);
277 if (coda_isroot(dir
) && coda_iscontrol(name
, length
))
282 error
= venus_create(dir
->i_sb
, &(dircnp
->c_fid
), name
, length
,
283 0, mode
, rdev
, &newfid
, &attrs
);
286 CDEBUG(D_INODE
, "mknod: %s, result %d\n",
287 coda_f2s(&newfid
), error
);
292 error
= coda_cnode_make(&result
, &newfid
, dir
->i_sb
);
299 /* invalidate the directory cnode's attributes */
300 dircnp
->c_flags
|= C_VATTR
;
301 d_instantiate(de
, result
);
305 static int coda_mkdir(struct inode
*dir
, struct dentry
*de
, int mode
)
307 struct coda_inode_info
*dircnp
;
309 struct coda_vattr attr
;
310 const char *name
= de
->d_name
.name
;
311 int len
= de
->d_name
.len
;
313 struct ViceFid newfid
;
316 coda_vfs_stat
.mkdir
++;
318 if (coda_isroot(dir
) && coda_iscontrol(name
, len
))
323 CDEBUG(D_INODE
, "mkdir %s (len %d) in %s, mode %o.\n",
324 name
, len
, coda_f2s(&(dircnp
->c_fid
)), mode
);
327 error
= venus_mkdir(dir
->i_sb
, &(dircnp
->c_fid
),
328 name
, len
, &newfid
, &attr
);
331 CDEBUG(D_INODE
, "mkdir error: %s result %d\n",
332 coda_f2s(&newfid
), error
);
337 CDEBUG(D_INODE
, "mkdir: new dir has fid %s.\n",
340 error
= coda_cnode_make(&inode
, &newfid
, dir
->i_sb
);
346 /* invalidate the directory cnode's attributes */
347 dircnp
->c_flags
|= C_VATTR
;
349 d_instantiate(de
, inode
);
353 /* try to make de an entry in dir_inodde linked to source_de */
354 static int coda_link(struct dentry
*source_de
, struct inode
*dir_inode
,
357 struct inode
*inode
= source_de
->d_inode
;
358 const char * name
= de
->d_name
.name
;
359 int len
= de
->d_name
.len
;
360 struct coda_inode_info
*dir_cnp
, *cnp
;
364 coda_vfs_stat
.link
++;
366 if (coda_isroot(dir_inode
) && coda_iscontrol(name
, len
))
369 dir_cnp
= ITOC(dir_inode
);
372 CDEBUG(D_INODE
, "old: fid: %s\n", coda_f2s(&(cnp
->c_fid
)));
373 CDEBUG(D_INODE
, "directory: %s\n", coda_f2s(&(dir_cnp
->c_fid
)));
375 error
= venus_link(dir_inode
->i_sb
,&(cnp
->c_fid
), &(dir_cnp
->c_fid
),
376 (const char *)name
, len
);
379 dir_cnp
->c_flags
|= C_VATTR
;
381 d_instantiate(de
, inode
);
388 CDEBUG(D_INODE
, "link result %d\n",error
);
394 static int coda_symlink(struct inode
*dir_inode
, struct dentry
*de
,
397 const char *name
= de
->d_name
.name
;
398 int len
= de
->d_name
.len
;
399 struct coda_inode_info
*dir_cnp
= ITOC(dir_inode
);
404 coda_vfs_stat
.symlink
++;
406 if (coda_isroot(dir_inode
) && coda_iscontrol(name
, len
))
409 symlen
= strlen(symname
);
410 if ( symlen
> CODA_MAXPATHLEN
)
411 return -ENAMETOOLONG
;
413 CDEBUG(D_INODE
, "symname: %s, length: %d\n", symname
, symlen
);
416 * This entry is now negative. Since we do not create
417 * an inode for the entry we have to drop it.
420 error
= venus_symlink(dir_inode
->i_sb
, &(dir_cnp
->c_fid
), name
, len
,
423 /* mtime is no good anymore */
425 dir_cnp
->c_flags
|= C_VATTR
;
428 CDEBUG(D_INODE
, "in symlink result %d\n",error
);
433 /* destruction routines: unlink, rmdir */
434 int coda_unlink(struct inode
*dir
, struct dentry
*de
)
436 struct coda_inode_info
*dircnp
= ITOC(dir
);
438 const char *name
= de
->d_name
.name
;
439 int len
= de
->d_name
.len
;
442 coda_vfs_stat
.unlink
++;
444 CDEBUG(D_INODE
, " %s in %s, dirino %ld\n", name
,
445 coda_f2s(&(dircnp
->c_fid
)), dir
->i_ino
);
447 error
= venus_remove(dir
->i_sb
, &(dircnp
->c_fid
), name
, len
);
449 CDEBUG(D_INODE
, "upc returned error %d\n", error
);
453 /* cache management: mtime has changed, ask Venus */
454 dircnp
->c_flags
|= C_VATTR
;
455 de
->d_inode
->i_nlink
--;
461 int coda_rmdir(struct inode
*dir
, struct dentry
*de
)
463 struct coda_inode_info
*dircnp
;
464 const char *name
= de
->d_name
.name
;
465 int len
= de
->d_name
.len
;
469 coda_vfs_stat
.rmdir
++;
473 if (!list_empty(&de
->d_hash
))
475 error
= venus_rmdir(dir
->i_sb
, &(dircnp
->c_fid
), name
, len
);
478 CDEBUG(D_INODE
, "upc returned error %d\n", error
);
482 if (de
->d_inode
->i_nlink
)
483 de
->d_inode
->i_nlink
--;
489 static int coda_rename(struct inode
*old_dir
, struct dentry
*old_dentry
,
490 struct inode
*new_dir
, struct dentry
*new_dentry
)
492 const char *old_name
= old_dentry
->d_name
.name
;
493 const char *new_name
= new_dentry
->d_name
.name
;
494 int old_length
= old_dentry
->d_name
.len
;
495 int new_length
= new_dentry
->d_name
.len
;
496 struct inode
*new_inode
= new_dentry
->d_inode
;
497 struct coda_inode_info
*new_cnp
, *old_cnp
;
501 coda_vfs_stat
.rename
++;
503 old_cnp
= ITOC(old_dir
);
504 new_cnp
= ITOC(new_dir
);
506 CDEBUG(D_INODE
, "old: %s, (%d length, %d strlen), new: %s"
507 "(%d length, %d strlen).old:d_count: %d, new:d_count: %d\n",
508 old_name
, old_length
, strlen(old_name
), new_name
, new_length
,
509 strlen(new_name
),old_dentry
->d_count
, new_dentry
->d_count
);
511 /* the C library will do unlink/create etc */
512 if ( coda_crossvol_rename
== 0 &&
513 old_cnp
->c_fid
.Volume
!= new_cnp
->c_fid
.Volume
)
516 error
= venus_rename(old_dir
->i_sb
, &(old_cnp
->c_fid
),
517 &(new_cnp
->c_fid
), old_length
, new_length
,
518 (const char *) old_name
, (const char *)new_name
);
521 CDEBUG(D_INODE
, "returned error %d\n", error
);
525 coda_flag_inode(new_inode
, C_VATTR
);
526 coda_flag_inode(old_dir
, C_VATTR
);
527 coda_flag_inode(new_dir
, C_VATTR
);
529 CDEBUG(D_INODE
, "result %d\n", error
);
537 /* file operations for directories */
538 int coda_readdir(struct file
*file
, void *dirent
, filldir_t filldir
)
541 struct coda_inode_info
*cnp
;
542 struct file open_file
;
543 struct dentry open_dentry
;
544 struct inode
*inode
=file
->f_dentry
->d_inode
;
547 coda_vfs_stat
.readdir
++;
551 CDEBUG(D_FILE
, "open inode pointer = NULL.\n");
555 coda_prepare_openfile(inode
, file
, cnp
->c_ovp
, &open_file
,
557 if ( S_ISREG(cnp
->c_ovp
->i_mode
) ) {
558 /* Venus: we must read Venus dirents from the file */
559 result
= coda_venus_readdir(&open_file
, dirent
, filldir
);
561 /* potemkin case: we are handed a directory inode */
562 down(&cnp
->c_ovp
->i_sem
);
563 result
= open_file
.f_op
->readdir(&open_file
, dirent
, filldir
);
564 up(&cnp
->c_ovp
->i_sem
);
566 coda_restore_codafile(inode
, file
, cnp
->c_ovp
, &open_file
);
571 /* ask venus to cache the file and return the inode of the container file,
572 put this inode pointer in the cnode for future read/writes */
573 int coda_open(struct inode
*i
, struct file
*f
)
577 struct coda_inode_info
*cnp
;
579 struct inode
*cont_inode
= NULL
;
580 unsigned short flags
= f
->f_flags
& (~O_EXCL
);
581 unsigned short coda_flags
= coda_flags_to_cflags(flags
);
582 struct coda_cred
*cred
;
585 coda_vfs_stat
.open
++;
587 CDEBUG(D_SPECIAL
, "OPEN inode number: %ld, count %d, flags %o.\n",
588 f
->f_dentry
->d_inode
->i_ino
, f
->f_dentry
->d_count
, flags
);
593 error
= venus_open(i
->i_sb
, &(cnp
->c_fid
), coda_flags
, &ino
, &dev
);
595 CDEBUG(D_FILE
, "venus: dev %d, inode %ld, out->result %d\n",
600 /* coda_upcall returns ino number of cached object, get inode */
601 CDEBUG(D_FILE
, "cache file dev %d, ino %ld\n", dev
, ino
);
602 error
= coda_inode_grab(dev
, ino
, &cont_inode
);
604 if ( error
|| !cont_inode
){
605 printk("coda_open: coda_inode_grab error %d.", error
);
611 CODA_ALLOC(cred
, struct coda_cred
*, sizeof(*cred
));
612 coda_load_creds(cred
);
613 f
->private_data
= cred
;
619 cnp
->c_ovp
= cont_inode
;
622 CDEBUG(D_FILE
, "result %d, coda i->i_count is %d for ino %ld\n",
623 error
, i
->i_count
, i
->i_ino
);
624 CDEBUG(D_FILE
, "cache ino: %ld, count %d, ops %x\n",
625 cnp
->c_ovp
->i_ino
, cnp
->c_ovp
->i_count
,
626 (int)(cnp
->c_ovp
->i_op
));
631 int coda_release(struct inode
*i
, struct file
*f
)
633 struct coda_inode_info
*cnp
;
635 unsigned short flags
= (f
->f_flags
) & (~O_EXCL
);
636 unsigned short cflags
= coda_flags_to_cflags(flags
);
637 struct coda_cred
*cred
;
640 coda_vfs_stat
.release
++;
642 cred
= (struct coda_cred
*)f
->private_data
;
647 "RELEASE coda (ino %ld, ct %d) cache (ino %ld, ct %d)\n",
648 i
->i_ino
, i
->i_count
, (cnp
->c_ovp
? cnp
->c_ovp
->i_ino
: 0),
649 (cnp
->c_ovp
? cnp
->c_ovp
->i_count
: -99));
652 /* even when c_ocount=0 we cannot put c_ovp to
653 * NULL since the file may be mmapped.
654 * See code in inode.c (coda_put_inode) for
655 * further handling of close.
660 if (flags
& (O_WRONLY
| O_RDWR
)) {
664 error
= venus_release(i
->i_sb
, &(cnp
->c_fid
), cflags
, cred
);
666 CODA_FREE(cred
, sizeof(*cred
));
667 f
->private_data
= NULL
;
669 CDEBUG(D_FILE
, "coda_release: result: %d\n", error
);
673 /* support routines */
675 * this structure is manipulated by filldir in vfs layer.
676 * the count holds the remaining amount of space in the getdents buffer,
677 * beyond the current_dir pointer.
681 /* should be big enough to hold any single directory entry */
682 #define DIR_BUFSIZE 2048
684 static int coda_venus_readdir(struct file
*filp
, void *getdent
,
688 int offset
= filp
->f_pos
; /* offset in the directory file */
690 int pos
= 0; /* offset in the block we read */
691 int result
= 0; /* either an error or # of entries returned */
694 struct venus_dirent
*vdirent
;
695 int string_offset
= (int) (&((struct venus_dirent
*)(0))->d_name
);
700 CODA_ALLOC(buff
, char *, DIR_BUFSIZE
);
702 printk("coda_venus_readdir: out of memory.\n");
706 /* we use this routine to read the file into our buffer */
707 bufsize
= read_exec(filp
->f_dentry
, filp
->f_pos
, buff
, DIR_BUFSIZE
, 1);
709 printk("coda_venus_readdir: cannot read directory %d.\n",
719 /* Parse and write into user space. Filldir tells us when done! */
720 CDEBUG(D_FILE
, "buffsize: %d offset %d, count %d.\n",
721 bufsize
, offset
, count
);
725 while ( pos
+ string_offset
< bufsize
&& i
< 1024) {
726 vdirent
= (struct venus_dirent
*) (buff
+ pos
);
728 /* test if the name is fully in the buffer */
729 if ( pos
+ string_offset
+ (int) vdirent
->d_namlen
>= bufsize
){
731 printk("CODA: Invalid directory cfino: %ld\n",
732 filp
->f_dentry
->d_inode
->i_ino
);
735 /* now we are certain that we can read the entry from buff */
737 /* if we don't have a null entry, copy it */
738 if ( vdirent
->d_fileno
&& vdirent
->d_reclen
) {
739 int namlen
= vdirent
->d_namlen
;
740 off_t offs
= filp
->f_pos
;
741 ino_t ino
= vdirent
->d_fileno
;
742 char *name
= vdirent
->d_name
;
744 errfill
= filldir(getdent
, name
, namlen
,
746 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
);
747 /* errfill means no space for filling in this round */
756 filp
->f_pos
+= vdirent
->d_reclen
;
757 if ( filp
->f_pos
> filp
->f_dentry
->d_inode
->i_size
)
759 if ( !vdirent
->d_reclen
) {
760 printk("CODA: Invalid directory, cfino: %ld\n",
761 filp
->f_dentry
->d_inode
->i_ino
);
765 pos
+= (unsigned int) vdirent
->d_reclen
;
770 printk("Repeating too much in readdir %ld\n",
771 filp
->f_dentry
->d_inode
->i_ino
);
776 CODA_FREE(buff
, DIR_BUFSIZE
);
780 /* called when a cache lookup succeeds */
781 static int coda_dentry_revalidate(struct dentry
*de
, int flags
)
784 struct inode
*inode
= de
->d_inode
;
785 struct coda_inode_info
*cii
;
791 cii
= ITOC(de
->d_inode
);
792 if (coda_isroot(inode
))
794 if (is_bad_inode(inode
))
797 if (! (cii
->c_flags
& (C_PURGE
| C_FLUSH
)) )
800 shrink_dcache_parent(de
);
802 if (de
->d_count
> 1) {
803 /* pretend it's valid, but don't change the flags */
804 CDEBUG(D_DOWNCALL
, "BOOM for: ino %ld, %s\n",
805 de
->d_inode
->i_ino
, coda_f2s(&cii
->c_fid
));
809 /* propagate for a flush */
810 if (cii
->c_flags
& C_FLUSH
)
811 coda_flag_inode_children(inode
, C_FLUSH
);
813 /* clear the flags. */
814 cii
->c_flags
&= ~(C_VATTR
| C_PURGE
| C_FLUSH
);
820 * This is the callback from dput() when d_count is going to 0.
821 * We use this to unhash dentries with bad inodes.
823 static void coda_dentry_delete(struct dentry
* dentry
)
827 if (!dentry
->d_inode
)
830 flags
= (ITOC(dentry
->d_inode
)->c_flags
) & C_PURGE
;
831 if (is_bad_inode(dentry
->d_inode
) || flags
) {
832 CDEBUG(D_DOWNCALL
, "bad inode, unhashing %s/%s, %ld\n",
833 dentry
->d_parent
->d_name
.name
, dentry
->d_name
.name
,
834 dentry
->d_inode
->i_ino
);
842 * This is called when we want to check if the inode has
843 * changed on the server. Coda makes this easy since the
844 * cache manager Venus issues a downcall to the kernel when this
848 int coda_revalidate_inode(struct dentry
*dentry
)
850 struct coda_vattr attr
;
854 struct inode
*inode
= dentry
->d_inode
;
855 struct coda_inode_info
*cii
= ITOC(inode
);
858 CDEBUG(D_INODE
, "revalidating: %*s/%*s\n",
859 dentry
->d_name
.len
, dentry
->d_name
.name
,
860 dentry
->d_parent
->d_name
.len
, dentry
->d_parent
->d_name
.name
);
862 if ( cii
->c_flags
== 0 )
865 /* Venus closed the device .... */
866 if ( cii
->c_flags
& C_DYING
) {
867 make_bad_inode(inode
);
872 if (cii
->c_flags
& (C_VATTR
| C_PURGE
| C_FLUSH
)) {
873 error
= venus_getattr(inode
->i_sb
, &(cii
->c_fid
), &attr
);
875 make_bad_inode(inode
);
879 /* this inode may be lost if:
881 - type changes must be permitted for repair and
882 missing mount points.
884 old_mode
= inode
->i_mode
;
885 old_ino
= inode
->i_ino
;
886 coda_vattr_to_iattr(inode
, &attr
);
889 if ((old_mode
& S_IFMT
) != (inode
->i_mode
& S_IFMT
)) {
890 printk("Coda: inode %ld, fid %s changed type!\n",
891 inode
->i_ino
, coda_f2s(&(cii
->c_fid
)));
894 /* the following can happen when a local fid is replaced
895 with a global one, here we lose and declar the inode bad */
896 if (inode
->i_ino
!= old_ino
) {
897 make_bad_inode(inode
);
898 inode
->i_mode
= old_mode
;
903 coda_flag_inode_children(inode
, C_FLUSH
);
905 cii
->c_flags
&= ~(C_VATTR
| C_PURGE
| C_FLUSH
);