dir.c 17 KB

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