dir.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. /*
  2. * Directory operations for Coda filesystem
  3. * Original version: (C) 1996 P. Braam and M. Callahan
  4. * Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
  5. *
  6. * Carnegie Mellon encourages users to contribute improvements to
  7. * the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
  8. */
  9. #include <linux/types.h>
  10. #include <linux/kernel.h>
  11. #include <linux/time.h>
  12. #include <linux/fs.h>
  13. #include <linux/file.h>
  14. #include <linux/stat.h>
  15. #include <linux/errno.h>
  16. #include <linux/string.h>
  17. #include <linux/smp_lock.h>
  18. #include <asm/uaccess.h>
  19. #include <linux/coda.h>
  20. #include <linux/coda_linux.h>
  21. #include <linux/coda_psdev.h>
  22. #include <linux/coda_fs_i.h>
  23. #include <linux/coda_cache.h>
  24. #include "coda_int.h"
  25. /* dir inode-ops */
  26. static int coda_create(struct inode *dir, struct dentry *new, int mode, struct nameidata *nd);
  27. static struct dentry *coda_lookup(struct inode *dir, struct dentry *target, struct nameidata *nd);
  28. static int coda_link(struct dentry *old_dentry, struct inode *dir_inode,
  29. struct dentry *entry);
  30. static int coda_unlink(struct inode *dir_inode, struct dentry *entry);
  31. static int coda_symlink(struct inode *dir_inode, struct dentry *entry,
  32. const char *symname);
  33. static int coda_mkdir(struct inode *dir_inode, struct dentry *entry, int mode);
  34. static int coda_rmdir(struct inode *dir_inode, struct dentry *entry);
  35. static int coda_rename(struct inode *old_inode, struct dentry *old_dentry,
  36. struct inode *new_inode, struct dentry *new_dentry);
  37. /* dir file-ops */
  38. static int coda_readdir(struct file *file, void *buf, filldir_t filldir);
  39. /* dentry ops */
  40. static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd);
  41. static int coda_dentry_delete(struct dentry *);
  42. /* support routines */
  43. static int coda_venus_readdir(struct file *coda_file, void *buf,
  44. filldir_t filldir);
  45. /* same as fs/bad_inode.c */
  46. static int coda_return_EIO(void)
  47. {
  48. return -EIO;
  49. }
  50. #define CODA_EIO_ERROR ((void *) (coda_return_EIO))
  51. static const struct dentry_operations coda_dentry_operations =
  52. {
  53. .d_revalidate = coda_dentry_revalidate,
  54. .d_delete = coda_dentry_delete,
  55. };
  56. const struct inode_operations coda_dir_inode_operations =
  57. {
  58. .create = coda_create,
  59. .lookup = coda_lookup,
  60. .link = coda_link,
  61. .unlink = coda_unlink,
  62. .symlink = coda_symlink,
  63. .mkdir = coda_mkdir,
  64. .rmdir = coda_rmdir,
  65. .mknod = CODA_EIO_ERROR,
  66. .rename = coda_rename,
  67. .permission = coda_permission,
  68. .getattr = coda_getattr,
  69. .setattr = coda_setattr,
  70. };
  71. const struct file_operations coda_dir_operations = {
  72. .llseek = generic_file_llseek,
  73. .read = generic_read_dir,
  74. .readdir = coda_readdir,
  75. .open = coda_open,
  76. .release = coda_release,
  77. .fsync = coda_fsync,
  78. };
  79. /* inode operations for directories */
  80. /* access routines: lookup, readlink, permission */
  81. static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd)
  82. {
  83. struct inode *inode = NULL;
  84. struct CodaFid resfid = { { 0, } };
  85. int type = 0;
  86. int error = 0;
  87. const char *name = entry->d_name.name;
  88. size_t length = entry->d_name.len;
  89. if (length > CODA_MAXNAMLEN) {
  90. printk(KERN_ERR "name too long: lookup, %s (%*s)\n",
  91. coda_i2s(dir), (int)length, name);
  92. return ERR_PTR(-ENAMETOOLONG);
  93. }
  94. /* control object, create inode on the fly */
  95. if (coda_isroot(dir) && coda_iscontrol(name, length)) {
  96. error = coda_cnode_makectl(&inode, dir->i_sb);
  97. type = CODA_NOCACHE;
  98. goto exit;
  99. }
  100. lock_kernel();
  101. error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length,
  102. &type, &resfid);
  103. if (!error)
  104. error = coda_cnode_make(&inode, &resfid, dir->i_sb);
  105. unlock_kernel();
  106. if (error && error != -ENOENT)
  107. return ERR_PTR(error);
  108. exit:
  109. entry->d_op = &coda_dentry_operations;
  110. if (inode && (type & CODA_NOCACHE))
  111. coda_flag_inode(inode, C_VATTR | C_PURGE);
  112. return d_splice_alias(inode, entry);
  113. }
  114. int coda_permission(struct inode *inode, int mask)
  115. {
  116. int error = 0;
  117. mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
  118. if (!mask)
  119. return 0;
  120. if ((mask & MAY_EXEC) && !execute_ok(inode))
  121. return -EACCES;
  122. lock_kernel();
  123. if (coda_cache_check(inode, mask))
  124. goto out;
  125. error = venus_access(inode->i_sb, coda_i2f(inode), mask);
  126. if (!error)
  127. coda_cache_enter(inode, mask);
  128. out:
  129. unlock_kernel();
  130. return error;
  131. }
  132. static inline void coda_dir_update_mtime(struct inode *dir)
  133. {
  134. #ifdef REQUERY_VENUS_FOR_MTIME
  135. /* invalidate the directory cnode's attributes so we refetch the
  136. * attributes from venus next time the inode is referenced */
  137. coda_flag_inode(dir, C_VATTR);
  138. #else
  139. /* optimistically we can also act as if our nose bleeds. The
  140. * granularity of the mtime is coarse anyways so we might actually be
  141. * right most of the time. Note: we only do this for directories. */
  142. dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
  143. #endif
  144. }
  145. /* we have to wrap inc_nlink/drop_nlink because sometimes userspace uses a
  146. * trick to fool GNU find's optimizations. If we can't be sure of the link
  147. * (because of volume mount points) we set i_nlink to 1 which forces find
  148. * to consider every child as a possible directory. We should also never
  149. * see an increment or decrement for deleted directories where i_nlink == 0 */
  150. static inline void coda_dir_inc_nlink(struct inode *dir)
  151. {
  152. if (dir->i_nlink >= 2)
  153. inc_nlink(dir);
  154. }
  155. static inline void coda_dir_drop_nlink(struct inode *dir)
  156. {
  157. if (dir->i_nlink > 2)
  158. drop_nlink(dir);
  159. }
  160. /* creation routines: create, mknod, mkdir, link, symlink */
  161. static int coda_create(struct inode *dir, struct dentry *de, int mode, struct nameidata *nd)
  162. {
  163. int error=0;
  164. const char *name=de->d_name.name;
  165. int length=de->d_name.len;
  166. struct inode *inode;
  167. struct CodaFid newfid;
  168. struct coda_vattr attrs;
  169. lock_kernel();
  170. if (coda_isroot(dir) && coda_iscontrol(name, length)) {
  171. unlock_kernel();
  172. return -EPERM;
  173. }
  174. error = venus_create(dir->i_sb, coda_i2f(dir), name, length,
  175. 0, mode, &newfid, &attrs);
  176. if ( error ) {
  177. unlock_kernel();
  178. d_drop(de);
  179. return error;
  180. }
  181. inode = coda_iget(dir->i_sb, &newfid, &attrs);
  182. if ( IS_ERR(inode) ) {
  183. unlock_kernel();
  184. d_drop(de);
  185. return PTR_ERR(inode);
  186. }
  187. /* invalidate the directory cnode's attributes */
  188. coda_dir_update_mtime(dir);
  189. unlock_kernel();
  190. d_instantiate(de, inode);
  191. return 0;
  192. }
  193. static int coda_mkdir(struct inode *dir, struct dentry *de, int mode)
  194. {
  195. struct inode *inode;
  196. struct coda_vattr attrs;
  197. const char *name = de->d_name.name;
  198. int len = de->d_name.len;
  199. int error;
  200. struct CodaFid newfid;
  201. lock_kernel();
  202. if (coda_isroot(dir) && coda_iscontrol(name, len)) {
  203. unlock_kernel();
  204. return -EPERM;
  205. }
  206. attrs.va_mode = mode;
  207. error = venus_mkdir(dir->i_sb, coda_i2f(dir),
  208. name, len, &newfid, &attrs);
  209. if ( error ) {
  210. unlock_kernel();
  211. d_drop(de);
  212. return error;
  213. }
  214. inode = coda_iget(dir->i_sb, &newfid, &attrs);
  215. if ( IS_ERR(inode) ) {
  216. unlock_kernel();
  217. d_drop(de);
  218. return PTR_ERR(inode);
  219. }
  220. /* invalidate the directory cnode's attributes */
  221. coda_dir_inc_nlink(dir);
  222. coda_dir_update_mtime(dir);
  223. unlock_kernel();
  224. d_instantiate(de, inode);
  225. return 0;
  226. }
  227. /* try to make de an entry in dir_inodde linked to source_de */
  228. static int coda_link(struct dentry *source_de, struct inode *dir_inode,
  229. struct dentry *de)
  230. {
  231. struct inode *inode = source_de->d_inode;
  232. const char * name = de->d_name.name;
  233. int len = de->d_name.len;
  234. int error;
  235. lock_kernel();
  236. if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) {
  237. unlock_kernel();
  238. return -EPERM;
  239. }
  240. error = venus_link(dir_inode->i_sb, coda_i2f(inode),
  241. coda_i2f(dir_inode), (const char *)name, len);
  242. if (error) {
  243. d_drop(de);
  244. goto out;
  245. }
  246. coda_dir_update_mtime(dir_inode);
  247. atomic_inc(&inode->i_count);
  248. d_instantiate(de, inode);
  249. inc_nlink(inode);
  250. out:
  251. unlock_kernel();
  252. return(error);
  253. }
  254. static int coda_symlink(struct inode *dir_inode, struct dentry *de,
  255. const char *symname)
  256. {
  257. const char *name = de->d_name.name;
  258. int len = de->d_name.len;
  259. int symlen;
  260. int error = 0;
  261. lock_kernel();
  262. if (coda_isroot(dir_inode) && coda_iscontrol(name, len)) {
  263. unlock_kernel();
  264. return -EPERM;
  265. }
  266. symlen = strlen(symname);
  267. if ( symlen > CODA_MAXPATHLEN ) {
  268. unlock_kernel();
  269. return -ENAMETOOLONG;
  270. }
  271. /*
  272. * This entry is now negative. Since we do not create
  273. * an inode for the entry we have to drop it.
  274. */
  275. d_drop(de);
  276. error = venus_symlink(dir_inode->i_sb, coda_i2f(dir_inode), name, len,
  277. symname, symlen);
  278. /* mtime is no good anymore */
  279. if ( !error )
  280. coda_dir_update_mtime(dir_inode);
  281. unlock_kernel();
  282. return error;
  283. }
  284. /* destruction routines: unlink, rmdir */
  285. static int coda_unlink(struct inode *dir, struct dentry *de)
  286. {
  287. int error;
  288. const char *name = de->d_name.name;
  289. int len = de->d_name.len;
  290. lock_kernel();
  291. error = venus_remove(dir->i_sb, coda_i2f(dir), name, len);
  292. if ( error ) {
  293. unlock_kernel();
  294. return error;
  295. }
  296. coda_dir_update_mtime(dir);
  297. drop_nlink(de->d_inode);
  298. unlock_kernel();
  299. return 0;
  300. }
  301. static int coda_rmdir(struct inode *dir, struct dentry *de)
  302. {
  303. const char *name = de->d_name.name;
  304. int len = de->d_name.len;
  305. int error;
  306. lock_kernel();
  307. error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
  308. if (!error) {
  309. /* VFS may delete the child */
  310. if (de->d_inode)
  311. de->d_inode->i_nlink = 0;
  312. /* fix the link count of the parent */
  313. coda_dir_drop_nlink(dir);
  314. coda_dir_update_mtime(dir);
  315. }
  316. unlock_kernel();
  317. return error;
  318. }
  319. /* rename */
  320. static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
  321. struct inode *new_dir, struct dentry *new_dentry)
  322. {
  323. const char *old_name = old_dentry->d_name.name;
  324. const char *new_name = new_dentry->d_name.name;
  325. int old_length = old_dentry->d_name.len;
  326. int new_length = new_dentry->d_name.len;
  327. int error;
  328. lock_kernel();
  329. error = venus_rename(old_dir->i_sb, coda_i2f(old_dir),
  330. coda_i2f(new_dir), old_length, new_length,
  331. (const char *) old_name, (const char *)new_name);
  332. if ( !error ) {
  333. if ( new_dentry->d_inode ) {
  334. if ( S_ISDIR(new_dentry->d_inode->i_mode) ) {
  335. coda_dir_drop_nlink(old_dir);
  336. coda_dir_inc_nlink(new_dir);
  337. }
  338. coda_dir_update_mtime(old_dir);
  339. coda_dir_update_mtime(new_dir);
  340. coda_flag_inode(new_dentry->d_inode, C_VATTR);
  341. } else {
  342. coda_flag_inode(old_dir, C_VATTR);
  343. coda_flag_inode(new_dir, C_VATTR);
  344. }
  345. }
  346. unlock_kernel();
  347. return error;
  348. }
  349. /* file operations for directories */
  350. static int coda_readdir(struct file *coda_file, void *buf, filldir_t filldir)
  351. {
  352. struct coda_file_info *cfi;
  353. struct file *host_file;
  354. int ret;
  355. cfi = CODA_FTOC(coda_file);
  356. BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
  357. host_file = cfi->cfi_container;
  358. if (!host_file->f_op)
  359. return -ENOTDIR;
  360. if (host_file->f_op->readdir)
  361. {
  362. /* potemkin case: we were handed a directory inode.
  363. * We can't use vfs_readdir because we have to keep the file
  364. * position in sync between the coda_file and the host_file.
  365. * and as such we need grab the inode mutex. */
  366. struct inode *host_inode = host_file->f_path.dentry->d_inode;
  367. mutex_lock(&host_inode->i_mutex);
  368. host_file->f_pos = coda_file->f_pos;
  369. ret = -ENOENT;
  370. if (!IS_DEADDIR(host_inode)) {
  371. ret = host_file->f_op->readdir(host_file, buf, filldir);
  372. file_accessed(host_file);
  373. }
  374. coda_file->f_pos = host_file->f_pos;
  375. mutex_unlock(&host_inode->i_mutex);
  376. }
  377. else /* Venus: we must read Venus dirents from a file */
  378. ret = coda_venus_readdir(coda_file, buf, filldir);
  379. return ret;
  380. }
  381. static inline unsigned int CDT2DT(unsigned char cdt)
  382. {
  383. unsigned int dt;
  384. switch(cdt) {
  385. case CDT_UNKNOWN: dt = DT_UNKNOWN; break;
  386. case CDT_FIFO: dt = DT_FIFO; break;
  387. case CDT_CHR: dt = DT_CHR; break;
  388. case CDT_DIR: dt = DT_DIR; break;
  389. case CDT_BLK: dt = DT_BLK; break;
  390. case CDT_REG: dt = DT_REG; break;
  391. case CDT_LNK: dt = DT_LNK; break;
  392. case CDT_SOCK: dt = DT_SOCK; break;
  393. case CDT_WHT: dt = DT_WHT; break;
  394. default: dt = DT_UNKNOWN; break;
  395. }
  396. return dt;
  397. }
  398. /* support routines */
  399. static int coda_venus_readdir(struct file *coda_file, void *buf,
  400. filldir_t filldir)
  401. {
  402. int result = 0; /* # of entries returned */
  403. struct coda_file_info *cfi;
  404. struct coda_inode_info *cii;
  405. struct file *host_file;
  406. struct dentry *de;
  407. struct venus_dirent *vdir;
  408. unsigned long vdir_size =
  409. (unsigned long)(&((struct venus_dirent *)0)->d_name);
  410. unsigned int type;
  411. struct qstr name;
  412. ino_t ino;
  413. int ret;
  414. cfi = CODA_FTOC(coda_file);
  415. BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
  416. host_file = cfi->cfi_container;
  417. de = coda_file->f_path.dentry;
  418. cii = ITOC(de->d_inode);
  419. vdir = kmalloc(sizeof(*vdir), GFP_KERNEL);
  420. if (!vdir) return -ENOMEM;
  421. if (coda_file->f_pos == 0) {
  422. ret = filldir(buf, ".", 1, 0, de->d_inode->i_ino, DT_DIR);
  423. if (ret < 0)
  424. goto out;
  425. result++;
  426. coda_file->f_pos++;
  427. }
  428. if (coda_file->f_pos == 1) {
  429. ret = filldir(buf, "..", 2, 1, de->d_parent->d_inode->i_ino, DT_DIR);
  430. if (ret < 0)
  431. goto out;
  432. result++;
  433. coda_file->f_pos++;
  434. }
  435. while (1) {
  436. /* read entries from the directory file */
  437. ret = kernel_read(host_file, coda_file->f_pos - 2, (char *)vdir,
  438. sizeof(*vdir));
  439. if (ret < 0) {
  440. printk(KERN_ERR "coda readdir: read dir %s failed %d\n",
  441. coda_f2s(&cii->c_fid), ret);
  442. break;
  443. }
  444. if (ret == 0) break; /* end of directory file reached */
  445. /* catch truncated reads */
  446. if (ret < vdir_size || ret < vdir_size + vdir->d_namlen) {
  447. printk(KERN_ERR "coda readdir: short read on %s\n",
  448. coda_f2s(&cii->c_fid));
  449. ret = -EBADF;
  450. break;
  451. }
  452. /* validate whether the directory file actually makes sense */
  453. if (vdir->d_reclen < vdir_size + vdir->d_namlen) {
  454. printk(KERN_ERR "coda readdir: invalid dir %s\n",
  455. coda_f2s(&cii->c_fid));
  456. ret = -EBADF;
  457. break;
  458. }
  459. name.len = vdir->d_namlen;
  460. name.name = vdir->d_name;
  461. /* Make sure we skip '.' and '..', we already got those */
  462. if (name.name[0] == '.' && (name.len == 1 ||
  463. (vdir->d_name[1] == '.' && name.len == 2)))
  464. vdir->d_fileno = name.len = 0;
  465. /* skip null entries */
  466. if (vdir->d_fileno && name.len) {
  467. /* try to look up this entry in the dcache, that way
  468. * userspace doesn't have to worry about breaking
  469. * getcwd by having mismatched inode numbers for
  470. * internal volume mountpoints. */
  471. ino = find_inode_number(de, &name);
  472. if (!ino) ino = vdir->d_fileno;
  473. type = CDT2DT(vdir->d_type);
  474. ret = filldir(buf, name.name, name.len,
  475. coda_file->f_pos, ino, type);
  476. /* failure means no space for filling in this round */
  477. if (ret < 0) break;
  478. result++;
  479. }
  480. /* we'll always have progress because d_reclen is unsigned and
  481. * we've already established it is non-zero. */
  482. coda_file->f_pos += vdir->d_reclen;
  483. }
  484. out:
  485. kfree(vdir);
  486. return result ? result : ret;
  487. }
  488. /* called when a cache lookup succeeds */
  489. static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd)
  490. {
  491. struct inode *inode = de->d_inode;
  492. struct coda_inode_info *cii;
  493. if (!inode)
  494. return 1;
  495. lock_kernel();
  496. if (coda_isroot(inode))
  497. goto out;
  498. if (is_bad_inode(inode))
  499. goto bad;
  500. cii = ITOC(de->d_inode);
  501. if (!(cii->c_flags & (C_PURGE | C_FLUSH)))
  502. goto out;
  503. shrink_dcache_parent(de);
  504. /* propagate for a flush */
  505. if (cii->c_flags & C_FLUSH)
  506. coda_flag_inode_children(inode, C_FLUSH);
  507. if (atomic_read(&de->d_count) > 1)
  508. /* pretend it's valid, but don't change the flags */
  509. goto out;
  510. /* clear the flags. */
  511. cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
  512. bad:
  513. unlock_kernel();
  514. return 0;
  515. out:
  516. unlock_kernel();
  517. return 1;
  518. }
  519. /*
  520. * This is the callback from dput() when d_count is going to 0.
  521. * We use this to unhash dentries with bad inodes.
  522. */
  523. static int coda_dentry_delete(struct dentry * dentry)
  524. {
  525. int flags;
  526. if (!dentry->d_inode)
  527. return 0;
  528. flags = (ITOC(dentry->d_inode)->c_flags) & C_PURGE;
  529. if (is_bad_inode(dentry->d_inode) || flags) {
  530. return 1;
  531. }
  532. return 0;
  533. }
  534. /*
  535. * This is called when we want to check if the inode has
  536. * changed on the server. Coda makes this easy since the
  537. * cache manager Venus issues a downcall to the kernel when this
  538. * happens
  539. */
  540. int coda_revalidate_inode(struct dentry *dentry)
  541. {
  542. struct coda_vattr attr;
  543. int error = 0;
  544. int old_mode;
  545. ino_t old_ino;
  546. struct inode *inode = dentry->d_inode;
  547. struct coda_inode_info *cii = ITOC(inode);
  548. lock_kernel();
  549. if ( !cii->c_flags )
  550. goto ok;
  551. if (cii->c_flags & (C_VATTR | C_PURGE | C_FLUSH)) {
  552. error = venus_getattr(inode->i_sb, &(cii->c_fid), &attr);
  553. if ( error )
  554. goto return_bad;
  555. /* this inode may be lost if:
  556. - it's ino changed
  557. - type changes must be permitted for repair and
  558. missing mount points.
  559. */
  560. old_mode = inode->i_mode;
  561. old_ino = inode->i_ino;
  562. coda_vattr_to_iattr(inode, &attr);
  563. if ((old_mode & S_IFMT) != (inode->i_mode & S_IFMT)) {
  564. printk("Coda: inode %ld, fid %s changed type!\n",
  565. inode->i_ino, coda_f2s(&(cii->c_fid)));
  566. }
  567. /* the following can happen when a local fid is replaced
  568. with a global one, here we lose and declare the inode bad */
  569. if (inode->i_ino != old_ino)
  570. goto return_bad;
  571. coda_flag_inode_children(inode, C_FLUSH);
  572. cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
  573. }
  574. ok:
  575. unlock_kernel();
  576. return 0;
  577. return_bad:
  578. unlock_kernel();
  579. return -EIO;
  580. }