dir.c 17 KB

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