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
=
72 symlink
: coda_symlink
,
77 permission
: coda_permission
,
78 revalidate
: coda_revalidate_inode
,
79 setattr
: coda_notify_change
,
82 struct file_operations coda_dir_operations
= {
83 read
: generic_read_dir
,
84 readdir
: coda_readdir
,
86 release
: coda_release
,
91 /* inode operations for directories */
92 /* acces routines: lookup, readlink, permission */
93 static struct dentry
*coda_lookup(struct inode
*dir
, struct dentry
*entry
)
95 struct coda_inode_info
*dircnp
;
96 struct inode
*res_inode
= NULL
;
97 struct ViceFid resfid
;
98 int dropme
= 0; /* to indicate entry should not be cached */
101 const char *name
= entry
->d_name
.name
;
102 size_t length
= entry
->d_name
.len
;
108 if ( length
> CODA_MAXNAMLEN
) {
109 printk("name too long: lookup, %s (%*s)\n",
110 coda_f2s(&dircnp
->c_fid
), (int)length
, name
);
111 return ERR_PTR(-ENAMETOOLONG
);
114 CDEBUG(D_INODE
, "name %s, len %ld in ino %ld, fid %s\n",
115 name
, (long)length
, dir
->i_ino
, coda_f2s(&dircnp
->c_fid
));
117 /* control object, create inode on the fly */
118 if (coda_isroot(dir
) && coda_iscontrol(name
, length
)) {
119 error
= coda_cnode_makectl(&res_inode
, dir
->i_sb
);
121 "Lookup on CTL object; dir ino %ld, count %d\n",
122 dir
->i_ino
, dir
->i_count
);
126 error
= venus_lookup(dir
->i_sb
, &(dircnp
->c_fid
),
127 (const char *)name
, length
, &type
, &resfid
);
131 if (type
& CODA_NOCACHE
) {
132 type
&= (~CODA_NOCACHE
);
133 CDEBUG(D_INODE
, "dropme set for %s\n",
137 error
= coda_cnode_make(&res_inode
, &resfid
, dir
->i_sb
);
139 return ERR_PTR(error
);
140 } else if (error
!= -ENOENT
) {
141 CDEBUG(D_INODE
, "error for %s(%*s)%d\n",
142 coda_f2s(&dircnp
->c_fid
), (int)length
, name
, error
);
143 return ERR_PTR(error
);
145 CDEBUG(D_INODE
, "lookup: %s is (%s), type %d result %d, dropme %d\n",
146 name
, coda_f2s(&resfid
), type
, error
, dropme
);
150 entry
->d_op
= &coda_dentry_operations
;
151 d_add(entry
, res_inode
);
154 ITOC(res_inode
)->c_flags
|= C_VATTR
;
161 int coda_permission(struct inode
*inode
, int mask
)
163 struct coda_inode_info
*cp
= ITOC(inode
);
167 coda_vfs_stat
.permission
++;
168 coda_permission_stat
.count
++;
174 if ( coda_access_cache
== 1 ) {
175 if ( coda_cache_check(inode
, mask
) ) {
176 coda_permission_stat
.hit_count
++;
183 CDEBUG(D_INODE
, "mask is %o\n", mask
);
184 error
= venus_access(inode
->i_sb
, &(cp
->c_fid
), mask
);
186 CDEBUG(D_INODE
, "fid: %s, ino: %ld (mask: %o) error: %d\n",
187 coda_f2s(&(cp
->c_fid
)), inode
->i_ino
, mask
, error
);
190 coda_cache_enter(inode
, mask
);
197 /* creation routines: create, mknod, mkdir, link, symlink */
199 static int coda_create(struct inode
*dir
, struct dentry
*de
, int mode
)
202 struct coda_inode_info
*dircnp
;
203 const char *name
=de
->d_name
.name
;
204 int length
=de
->d_name
.len
;
205 struct inode
*result
= NULL
;
206 struct ViceFid newfid
;
207 struct coda_vattr attrs
;
210 coda_vfs_stat
.create
++;
212 CDEBUG(D_INODE
, "name: %s, length %d, mode %o\n",name
, length
, mode
);
214 if (coda_isroot(dir
) && coda_iscontrol(name
, length
))
219 error
= venus_create(dir
->i_sb
, &(dircnp
->c_fid
), name
, length
,
220 0, mode
, 0, &newfid
, &attrs
);
223 CDEBUG(D_INODE
, "create: %s, result %d\n",
224 coda_f2s(&newfid
), error
);
229 error
= coda_cnode_make(&result
, &newfid
, dir
->i_sb
);
236 /* invalidate the directory cnode's attributes */
237 dircnp
->c_flags
|= C_VATTR
;
238 d_instantiate(de
, result
);
242 static int coda_mknod(struct inode
*dir
, struct dentry
*de
, int mode
, int rdev
)
245 struct coda_inode_info
*dircnp
;
246 const char *name
=de
->d_name
.name
;
247 int length
=de
->d_name
.len
;
248 struct inode
*result
= NULL
;
249 struct ViceFid newfid
;
250 struct coda_vattr attrs
;
252 if ( coda_hasmknod
== 0 )
255 coda_vfs_stat
.create
++;
257 CDEBUG(D_INODE
, "name: %s, length %d, mode %o, rdev %x\n",
258 name
, length
, mode
, rdev
);
260 if (coda_isroot(dir
) && coda_iscontrol(name
, length
))
265 error
= venus_create(dir
->i_sb
, &(dircnp
->c_fid
), name
, length
,
266 0, mode
, rdev
, &newfid
, &attrs
);
269 CDEBUG(D_INODE
, "mknod: %s, result %d\n",
270 coda_f2s(&newfid
), error
);
275 error
= coda_cnode_make(&result
, &newfid
, dir
->i_sb
);
282 /* invalidate the directory cnode's attributes */
283 dircnp
->c_flags
|= C_VATTR
;
284 d_instantiate(de
, result
);
288 static int coda_mkdir(struct inode
*dir
, struct dentry
*de
, int mode
)
290 struct coda_inode_info
*dircnp
;
292 struct coda_vattr attr
;
293 const char *name
= de
->d_name
.name
;
294 int len
= de
->d_name
.len
;
296 struct ViceFid newfid
;
299 coda_vfs_stat
.mkdir
++;
301 if (coda_isroot(dir
) && coda_iscontrol(name
, len
))
306 CDEBUG(D_INODE
, "mkdir %s (len %d) in %s, mode %o.\n",
307 name
, len
, coda_f2s(&(dircnp
->c_fid
)), mode
);
310 error
= venus_mkdir(dir
->i_sb
, &(dircnp
->c_fid
),
311 name
, len
, &newfid
, &attr
);
314 CDEBUG(D_INODE
, "mkdir error: %s result %d\n",
315 coda_f2s(&newfid
), error
);
320 CDEBUG(D_INODE
, "mkdir: new dir has fid %s.\n",
323 error
= coda_cnode_make(&inode
, &newfid
, dir
->i_sb
);
329 /* invalidate the directory cnode's attributes */
330 dircnp
->c_flags
|= C_VATTR
;
332 d_instantiate(de
, inode
);
336 /* try to make de an entry in dir_inodde linked to source_de */
337 static int coda_link(struct dentry
*source_de
, struct inode
*dir_inode
,
340 struct inode
*inode
= source_de
->d_inode
;
341 const char * name
= de
->d_name
.name
;
342 int len
= de
->d_name
.len
;
343 struct coda_inode_info
*dir_cnp
, *cnp
;
347 coda_vfs_stat
.link
++;
349 if (coda_isroot(dir_inode
) && coda_iscontrol(name
, len
))
352 dir_cnp
= ITOC(dir_inode
);
355 CDEBUG(D_INODE
, "old: fid: %s\n", coda_f2s(&(cnp
->c_fid
)));
356 CDEBUG(D_INODE
, "directory: %s\n", coda_f2s(&(dir_cnp
->c_fid
)));
358 error
= venus_link(dir_inode
->i_sb
,&(cnp
->c_fid
), &(dir_cnp
->c_fid
),
359 (const char *)name
, len
);
362 dir_cnp
->c_flags
|= C_VATTR
;
364 d_instantiate(de
, inode
);
371 CDEBUG(D_INODE
, "link result %d\n",error
);
377 static int coda_symlink(struct inode
*dir_inode
, struct dentry
*de
,
380 const char *name
= de
->d_name
.name
;
381 int len
= de
->d_name
.len
;
382 struct coda_inode_info
*dir_cnp
= ITOC(dir_inode
);
387 coda_vfs_stat
.symlink
++;
389 if (coda_isroot(dir_inode
) && coda_iscontrol(name
, len
))
392 symlen
= strlen(symname
);
393 if ( symlen
> CODA_MAXPATHLEN
)
394 return -ENAMETOOLONG
;
396 CDEBUG(D_INODE
, "symname: %s, length: %d\n", symname
, symlen
);
399 * This entry is now negative. Since we do not create
400 * an inode for the entry we have to drop it.
403 error
= venus_symlink(dir_inode
->i_sb
, &(dir_cnp
->c_fid
), name
, len
,
406 /* mtime is no good anymore */
408 dir_cnp
->c_flags
|= C_VATTR
;
411 CDEBUG(D_INODE
, "in symlink result %d\n",error
);
416 /* destruction routines: unlink, rmdir */
417 int coda_unlink(struct inode
*dir
, struct dentry
*de
)
419 struct coda_inode_info
*dircnp
= ITOC(dir
);
421 const char *name
= de
->d_name
.name
;
422 int len
= de
->d_name
.len
;
425 coda_vfs_stat
.unlink
++;
427 CDEBUG(D_INODE
, " %s in %s, dirino %ld\n", name
,
428 coda_f2s(&(dircnp
->c_fid
)), dir
->i_ino
);
430 error
= venus_remove(dir
->i_sb
, &(dircnp
->c_fid
), name
, len
);
432 CDEBUG(D_INODE
, "upc returned error %d\n", error
);
436 /* cache management: mtime has changed, ask Venus */
437 dircnp
->c_flags
|= C_VATTR
;
438 de
->d_inode
->i_nlink
--;
444 int coda_rmdir(struct inode
*dir
, struct dentry
*de
)
446 struct coda_inode_info
*dircnp
;
447 const char *name
= de
->d_name
.name
;
448 int len
= de
->d_name
.len
;
452 coda_vfs_stat
.rmdir
++;
456 if (!list_empty(&de
->d_hash
))
458 error
= venus_rmdir(dir
->i_sb
, &(dircnp
->c_fid
), name
, len
);
461 CDEBUG(D_INODE
, "upc returned error %d\n", error
);
465 if (de
->d_inode
->i_nlink
)
466 de
->d_inode
->i_nlink
--;
472 static int coda_rename(struct inode
*old_dir
, struct dentry
*old_dentry
,
473 struct inode
*new_dir
, struct dentry
*new_dentry
)
475 const char *old_name
= old_dentry
->d_name
.name
;
476 const char *new_name
= new_dentry
->d_name
.name
;
477 int old_length
= old_dentry
->d_name
.len
;
478 int new_length
= new_dentry
->d_name
.len
;
479 struct inode
*new_inode
= new_dentry
->d_inode
;
480 struct coda_inode_info
*new_cnp
, *old_cnp
;
484 coda_vfs_stat
.rename
++;
486 old_cnp
= ITOC(old_dir
);
487 new_cnp
= ITOC(new_dir
);
489 CDEBUG(D_INODE
, "old: %s, (%d length, %ld strlen), new: %s"
490 "(%d length, %ld strlen).old:d_count: %d, new:d_count: %d\n",
491 old_name
, old_length
, (long)strlen(old_name
), new_name
, new_length
,
492 (long)strlen(new_name
),old_dentry
->d_count
, new_dentry
->d_count
);
494 /* the C library will do unlink/create etc */
495 if ( coda_crossvol_rename
== 0 &&
496 old_cnp
->c_fid
.Volume
!= new_cnp
->c_fid
.Volume
)
499 error
= venus_rename(old_dir
->i_sb
, &(old_cnp
->c_fid
),
500 &(new_cnp
->c_fid
), old_length
, new_length
,
501 (const char *) old_name
, (const char *)new_name
);
504 CDEBUG(D_INODE
, "returned error %d\n", error
);
508 coda_flag_inode(new_inode
, C_VATTR
);
509 coda_flag_inode(old_dir
, C_VATTR
);
510 coda_flag_inode(new_dir
, C_VATTR
);
512 CDEBUG(D_INODE
, "result %d\n", error
);
519 /* file operations for directories */
520 int coda_readdir(struct file
*file
, void *dirent
, filldir_t filldir
)
523 struct coda_inode_info
*cnp
;
524 struct file open_file
;
525 struct dentry open_dentry
;
526 struct inode
*inode
=file
->f_dentry
->d_inode
;
529 coda_vfs_stat
.readdir
++;
533 CDEBUG(D_FILE
, "open inode pointer = NULL.\n");
537 coda_prepare_openfile(inode
, file
, cnp
->c_ovp
, &open_file
,
539 if ( S_ISREG(cnp
->c_ovp
->i_mode
) ) {
540 /* Venus: we must read Venus dirents from the file */
541 result
= coda_venus_readdir(&open_file
, dirent
, filldir
);
543 /* potemkin case: we are handed a directory inode */
544 down(&cnp
->c_ovp
->i_sem
);
545 result
= open_file
.f_op
->readdir(&open_file
, dirent
, filldir
);
546 up(&cnp
->c_ovp
->i_sem
);
548 coda_restore_codafile(inode
, file
, cnp
->c_ovp
, &open_file
);
553 /* ask venus to cache the file and return the inode of the container file,
554 put this inode pointer in the cnode for future read/writes */
555 int coda_open(struct inode
*i
, struct file
*f
)
559 struct coda_inode_info
*cnp
;
561 struct inode
*cont_inode
= NULL
;
562 unsigned short flags
= f
->f_flags
& (~O_EXCL
);
563 unsigned short coda_flags
= coda_flags_to_cflags(flags
);
564 struct coda_cred
*cred
;
567 coda_vfs_stat
.open
++;
569 CDEBUG(D_SPECIAL
, "OPEN inode number: %ld, count %d, flags %o.\n",
570 f
->f_dentry
->d_inode
->i_ino
, f
->f_dentry
->d_count
, flags
);
575 error
= venus_open(i
->i_sb
, &(cnp
->c_fid
), coda_flags
, &ino
, &dev
);
577 CDEBUG(D_FILE
, "venus: dev %d, inode %ld, out->result %d\n",
578 dev
, (long)ino
, error
);
582 /* coda_upcall returns ino number of cached object, get inode */
583 CDEBUG(D_FILE
, "cache file dev %d, ino %ld\n", dev
, (long)ino
);
584 error
= coda_inode_grab(dev
, ino
, &cont_inode
);
586 if ( error
|| !cont_inode
){
587 printk("coda_open: coda_inode_grab error %d.", error
);
593 CODA_ALLOC(cred
, struct coda_cred
*, sizeof(*cred
));
594 coda_load_creds(cred
);
595 f
->private_data
= cred
;
600 cnp
->c_ovp
= cont_inode
;
601 i
->i_mapping
= cont_inode
->i_mapping
;
604 CDEBUG(D_FILE
, "result %d, coda i->i_count is %d for ino %ld\n",
605 error
, i
->i_count
, i
->i_ino
);
606 CDEBUG(D_FILE
, "cache ino: %ld, count %d, ops %p\n",
607 cnp
->c_ovp
->i_ino
, cnp
->c_ovp
->i_count
,
613 int coda_release(struct inode
*i
, struct file
*f
)
615 struct coda_inode_info
*cnp
;
617 unsigned short flags
= (f
->f_flags
) & (~O_EXCL
);
618 unsigned short cflags
= coda_flags_to_cflags(flags
);
619 struct coda_cred
*cred
;
622 coda_vfs_stat
.release
++;
624 cred
= (struct coda_cred
*)f
->private_data
;
629 "RELEASE coda (ino %ld, ct %d) cache (ino %ld, ct %d)\n",
630 i
->i_ino
, i
->i_count
, (cnp
->c_ovp
? cnp
->c_ovp
->i_ino
: 0),
631 (cnp
->c_ovp
? cnp
->c_ovp
->i_count
: -99));
634 /* even when c_ocount=0 we cannot put c_ovp to
635 * NULL since the file may be mmapped.
636 * See code in inode.c (coda_put_inode) for
637 * further handling of close.
642 if ( flags
& (O_WRONLY
| O_RDWR
) )
645 /* Venus closing a container file? don't bother making the upcall. */
646 if ( current
->pid
!= coda_upc_comm
.vc_pid
) {
647 error
= venus_release(i
->i_sb
, &(cnp
->c_fid
), cflags
, cred
);
650 f
->private_data
= NULL
;
652 CODA_FREE(cred
, sizeof(*cred
));
654 CDEBUG(D_FILE
, "coda_release: result: %d\n", error
);
658 /* support routines */
660 * this structure is manipulated by filldir in vfs layer.
661 * the count holds the remaining amount of space in the getdents buffer,
662 * beyond the current_dir pointer.
666 /* should be big enough to hold any single directory entry */
667 #define DIR_BUFSIZE 2048
669 static int coda_venus_readdir(struct file
*filp
, void *getdent
,
673 int offset
= filp
->f_pos
; /* offset in the directory file */
675 int pos
= 0; /* offset in the block we read */
676 int result
= 0; /* either an error or # of entries returned */
679 struct venus_dirent
*vdirent
;
680 int string_offset
= (int) (&((struct venus_dirent
*)(0))->d_name
);
685 CODA_ALLOC(buff
, char *, DIR_BUFSIZE
);
687 printk("coda_venus_readdir: out of memory.\n");
691 /* we use this routine to read the file into our buffer */
692 bufsize
= read_exec(filp
->f_dentry
, filp
->f_pos
, buff
, DIR_BUFSIZE
, 1);
694 printk("coda_venus_readdir: cannot read directory %d.\n",
704 /* Parse and write into user space. Filldir tells us when done! */
705 CDEBUG(D_FILE
, "buffsize: %d offset %d, count %d.\n",
706 bufsize
, offset
, count
);
710 while ( pos
+ string_offset
< bufsize
&& i
< 1024) {
711 vdirent
= (struct venus_dirent
*) (buff
+ pos
);
713 /* test if the name is fully in the buffer */
714 if ( pos
+ string_offset
+ (int) vdirent
->d_namlen
>= bufsize
){
716 printk("CODA: Invalid directory cfino: %ld\n",
717 filp
->f_dentry
->d_inode
->i_ino
);
720 /* now we are certain that we can read the entry from buff */
722 /* if we don't have a null entry, copy it */
723 if ( vdirent
->d_fileno
&& vdirent
->d_reclen
) {
724 int namlen
= vdirent
->d_namlen
;
725 off_t offs
= filp
->f_pos
;
726 ino_t ino
= vdirent
->d_fileno
;
727 char *name
= vdirent
->d_name
;
729 errfill
= filldir(getdent
, name
, namlen
,
731 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
);
732 /* errfill means no space for filling in this round */
741 filp
->f_pos
+= vdirent
->d_reclen
;
742 if ( filp
->f_pos
> filp
->f_dentry
->d_inode
->i_size
)
744 if ( !vdirent
->d_reclen
) {
745 printk("CODA: Invalid directory, cfino: %ld\n",
746 filp
->f_dentry
->d_inode
->i_ino
);
750 pos
+= (unsigned int) vdirent
->d_reclen
;
755 printk("Repeating too much in readdir %ld\n",
756 filp
->f_dentry
->d_inode
->i_ino
);
761 CODA_FREE(buff
, DIR_BUFSIZE
);
765 /* called when a cache lookup succeeds */
766 static int coda_dentry_revalidate(struct dentry
*de
, int flags
)
769 struct inode
*inode
= de
->d_inode
;
770 struct coda_inode_info
*cii
;
776 cii
= ITOC(de
->d_inode
);
777 if (coda_isroot(inode
))
779 if (is_bad_inode(inode
))
782 if (! (cii
->c_flags
& (C_PURGE
| C_FLUSH
)) )
785 shrink_dcache_parent(de
);
787 /* propagate for a flush */
788 if (cii
->c_flags
& C_FLUSH
)
789 coda_flag_inode_children(inode
, C_FLUSH
);
791 if (de
->d_count
> 1) {
792 /* pretend it's valid, but don't change the flags */
793 CDEBUG(D_DOWNCALL
, "BOOM for: ino %ld, %s\n",
794 de
->d_inode
->i_ino
, coda_f2s(&cii
->c_fid
));
798 /* clear the flags. */
799 cii
->c_flags
&= ~(C_VATTR
| C_PURGE
| C_FLUSH
);
805 * This is the callback from dput() when d_count is going to 0.
806 * We use this to unhash dentries with bad inodes.
808 static void coda_dentry_delete(struct dentry
* dentry
)
812 if (!dentry
->d_inode
)
815 flags
= (ITOC(dentry
->d_inode
)->c_flags
) & C_PURGE
;
816 if (is_bad_inode(dentry
->d_inode
) || flags
) {
817 CDEBUG(D_DOWNCALL
, "bad inode, unhashing %s/%s, %ld\n",
818 dentry
->d_parent
->d_name
.name
, dentry
->d_name
.name
,
819 dentry
->d_inode
->i_ino
);
827 * This is called when we want to check if the inode has
828 * changed on the server. Coda makes this easy since the
829 * cache manager Venus issues a downcall to the kernel when this
833 int coda_revalidate_inode(struct dentry
*dentry
)
835 struct coda_vattr attr
;
839 struct inode
*inode
= dentry
->d_inode
;
840 struct coda_inode_info
*cii
= ITOC(inode
);
843 CDEBUG(D_INODE
, "revalidating: %*s/%*s\n",
844 dentry
->d_name
.len
, dentry
->d_name
.name
,
845 dentry
->d_parent
->d_name
.len
, dentry
->d_parent
->d_name
.name
);
847 if ( cii
->c_flags
== 0 )
850 /* Venus accessing a container file, don't try to revalidate */
851 if ( current
->pid
== coda_upc_comm
.vc_pid
)
854 /* Venus closed the device .... */
855 if ( cii
->c_flags
& C_DYING
)
856 goto return_bad_inode
;
858 if (cii
->c_flags
& (C_VATTR
| C_PURGE
| C_FLUSH
)) {
859 error
= venus_getattr(inode
->i_sb
, &(cii
->c_fid
), &attr
);
861 goto return_bad_inode
;
863 /* this inode may be lost if:
865 - type changes must be permitted for repair and
866 missing mount points.
868 old_mode
= inode
->i_mode
;
869 old_ino
= inode
->i_ino
;
870 coda_vattr_to_iattr(inode
, &attr
);
873 if ((old_mode
& S_IFMT
) != (inode
->i_mode
& S_IFMT
)) {
874 printk("Coda: inode %ld, fid %s changed type!\n",
875 inode
->i_ino
, coda_f2s(&(cii
->c_fid
)));
878 /* the following can happen when a local fid is replaced
879 with a global one, here we lose and declare the inode bad */
880 if (inode
->i_ino
!= old_ino
)
881 goto return_bad_inode
;
884 coda_flag_inode_children(inode
, C_FLUSH
);
886 cii
->c_flags
&= ~(C_VATTR
| C_PURGE
| C_FLUSH
);
894 inode
->i_mapping
= &inode
->i_data
;
897 make_bad_inode(inode
);