dir.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /*
  2. * dir.c
  3. *
  4. * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke
  5. * Copyright (C) 1997 by Volker Lendecke
  6. *
  7. * Please add a note about your changes to smbfs in the ChangeLog file.
  8. */
  9. #include <linux/time.h>
  10. #include <linux/errno.h>
  11. #include <linux/kernel.h>
  12. #include <linux/smp_lock.h>
  13. #include <linux/ctype.h>
  14. #include <linux/net.h>
  15. #include <linux/sched.h>
  16. #include <linux/smb_fs.h>
  17. #include <linux/smb_mount.h>
  18. #include <linux/smbno.h>
  19. #include "smb_debug.h"
  20. #include "proto.h"
  21. static int smb_readdir(struct file *, void *, filldir_t);
  22. static int smb_dir_open(struct inode *, struct file *);
  23. static struct dentry *smb_lookup(struct inode *, struct dentry *, struct nameidata *);
  24. static int smb_create(struct inode *, struct dentry *, int, struct nameidata *);
  25. static int smb_mkdir(struct inode *, struct dentry *, int);
  26. static int smb_rmdir(struct inode *, struct dentry *);
  27. static int smb_unlink(struct inode *, struct dentry *);
  28. static int smb_rename(struct inode *, struct dentry *,
  29. struct inode *, struct dentry *);
  30. static int smb_make_node(struct inode *,struct dentry *,int,dev_t);
  31. static int smb_link(struct dentry *, struct inode *, struct dentry *);
  32. const struct file_operations smb_dir_operations =
  33. {
  34. .llseek = generic_file_llseek,
  35. .read = generic_read_dir,
  36. .readdir = smb_readdir,
  37. .unlocked_ioctl = smb_ioctl,
  38. .open = smb_dir_open,
  39. };
  40. const struct inode_operations smb_dir_inode_operations =
  41. {
  42. .create = smb_create,
  43. .lookup = smb_lookup,
  44. .unlink = smb_unlink,
  45. .mkdir = smb_mkdir,
  46. .rmdir = smb_rmdir,
  47. .rename = smb_rename,
  48. .getattr = smb_getattr,
  49. .setattr = smb_notify_change,
  50. };
  51. const struct inode_operations smb_dir_inode_operations_unix =
  52. {
  53. .create = smb_create,
  54. .lookup = smb_lookup,
  55. .unlink = smb_unlink,
  56. .mkdir = smb_mkdir,
  57. .rmdir = smb_rmdir,
  58. .rename = smb_rename,
  59. .getattr = smb_getattr,
  60. .setattr = smb_notify_change,
  61. .symlink = smb_symlink,
  62. .mknod = smb_make_node,
  63. .link = smb_link,
  64. };
  65. /*
  66. * Read a directory, using filldir to fill the dirent memory.
  67. * smb_proc_readdir does the actual reading from the smb server.
  68. *
  69. * The cache code is almost directly taken from ncpfs
  70. */
  71. static int
  72. smb_readdir(struct file *filp, void *dirent, filldir_t filldir)
  73. {
  74. struct dentry *dentry = filp->f_path.dentry;
  75. struct inode *dir = dentry->d_inode;
  76. struct smb_sb_info *server = server_from_dentry(dentry);
  77. union smb_dir_cache *cache = NULL;
  78. struct smb_cache_control ctl;
  79. struct page *page = NULL;
  80. int result;
  81. ctl.page = NULL;
  82. ctl.cache = NULL;
  83. VERBOSE("reading %s/%s, f_pos=%d\n",
  84. DENTRY_PATH(dentry), (int) filp->f_pos);
  85. result = 0;
  86. lock_kernel();
  87. switch ((unsigned int) filp->f_pos) {
  88. case 0:
  89. if (filldir(dirent, ".", 1, 0, dir->i_ino, DT_DIR) < 0)
  90. goto out;
  91. filp->f_pos = 1;
  92. /* fallthrough */
  93. case 1:
  94. if (filldir(dirent, "..", 2, 1, parent_ino(dentry), DT_DIR) < 0)
  95. goto out;
  96. filp->f_pos = 2;
  97. }
  98. /*
  99. * Make sure our inode is up-to-date.
  100. */
  101. result = smb_revalidate_inode(dentry);
  102. if (result)
  103. goto out;
  104. page = grab_cache_page(&dir->i_data, 0);
  105. if (!page)
  106. goto read_really;
  107. ctl.cache = cache = kmap(page);
  108. ctl.head = cache->head;
  109. if (!PageUptodate(page) || !ctl.head.eof) {
  110. VERBOSE("%s/%s, page uptodate=%d, eof=%d\n",
  111. DENTRY_PATH(dentry), PageUptodate(page),ctl.head.eof);
  112. goto init_cache;
  113. }
  114. if (filp->f_pos == 2) {
  115. if (jiffies - ctl.head.time >= SMB_MAX_AGE(server))
  116. goto init_cache;
  117. /*
  118. * N.B. ncpfs checks mtime of dentry too here, we don't.
  119. * 1. common smb servers do not update mtime on dir changes
  120. * 2. it requires an extra smb request
  121. * (revalidate has the same timeout as ctl.head.time)
  122. *
  123. * Instead smbfs invalidates its own cache on local changes
  124. * and remote changes are not seen until timeout.
  125. */
  126. }
  127. if (filp->f_pos > ctl.head.end)
  128. goto finished;
  129. ctl.fpos = filp->f_pos + (SMB_DIRCACHE_START - 2);
  130. ctl.ofs = ctl.fpos / SMB_DIRCACHE_SIZE;
  131. ctl.idx = ctl.fpos % SMB_DIRCACHE_SIZE;
  132. for (;;) {
  133. if (ctl.ofs != 0) {
  134. ctl.page = find_lock_page(&dir->i_data, ctl.ofs);
  135. if (!ctl.page)
  136. goto invalid_cache;
  137. ctl.cache = kmap(ctl.page);
  138. if (!PageUptodate(ctl.page))
  139. goto invalid_cache;
  140. }
  141. while (ctl.idx < SMB_DIRCACHE_SIZE) {
  142. struct dentry *dent;
  143. int res;
  144. dent = smb_dget_fpos(ctl.cache->dentry[ctl.idx],
  145. dentry, filp->f_pos);
  146. if (!dent)
  147. goto invalid_cache;
  148. res = filldir(dirent, dent->d_name.name,
  149. dent->d_name.len, filp->f_pos,
  150. dent->d_inode->i_ino, DT_UNKNOWN);
  151. dput(dent);
  152. if (res)
  153. goto finished;
  154. filp->f_pos += 1;
  155. ctl.idx += 1;
  156. if (filp->f_pos > ctl.head.end)
  157. goto finished;
  158. }
  159. if (ctl.page) {
  160. kunmap(ctl.page);
  161. SetPageUptodate(ctl.page);
  162. unlock_page(ctl.page);
  163. page_cache_release(ctl.page);
  164. ctl.page = NULL;
  165. }
  166. ctl.idx = 0;
  167. ctl.ofs += 1;
  168. }
  169. invalid_cache:
  170. if (ctl.page) {
  171. kunmap(ctl.page);
  172. unlock_page(ctl.page);
  173. page_cache_release(ctl.page);
  174. ctl.page = NULL;
  175. }
  176. ctl.cache = cache;
  177. init_cache:
  178. smb_invalidate_dircache_entries(dentry);
  179. ctl.head.time = jiffies;
  180. ctl.head.eof = 0;
  181. ctl.fpos = 2;
  182. ctl.ofs = 0;
  183. ctl.idx = SMB_DIRCACHE_START;
  184. ctl.filled = 0;
  185. ctl.valid = 1;
  186. read_really:
  187. result = server->ops->readdir(filp, dirent, filldir, &ctl);
  188. if (result == -ERESTARTSYS && page)
  189. ClearPageUptodate(page);
  190. if (ctl.idx == -1)
  191. goto invalid_cache; /* retry */
  192. ctl.head.end = ctl.fpos - 1;
  193. ctl.head.eof = ctl.valid;
  194. finished:
  195. if (page) {
  196. cache->head = ctl.head;
  197. kunmap(page);
  198. if (result != -ERESTARTSYS)
  199. SetPageUptodate(page);
  200. unlock_page(page);
  201. page_cache_release(page);
  202. }
  203. if (ctl.page) {
  204. kunmap(ctl.page);
  205. SetPageUptodate(ctl.page);
  206. unlock_page(ctl.page);
  207. page_cache_release(ctl.page);
  208. }
  209. out:
  210. unlock_kernel();
  211. return result;
  212. }
  213. static int
  214. smb_dir_open(struct inode *dir, struct file *file)
  215. {
  216. struct dentry *dentry = file->f_path.dentry;
  217. struct smb_sb_info *server;
  218. int error = 0;
  219. VERBOSE("(%s/%s)\n", dentry->d_parent->d_name.name,
  220. file->f_path.dentry->d_name.name);
  221. /*
  222. * Directory timestamps in the core protocol aren't updated
  223. * when a file is added, so we give them a very short TTL.
  224. */
  225. lock_kernel();
  226. server = server_from_dentry(dentry);
  227. if (server->opt.protocol < SMB_PROTOCOL_LANMAN2) {
  228. unsigned long age = jiffies - SMB_I(dir)->oldmtime;
  229. if (age > 2*HZ)
  230. smb_invalid_dir_cache(dir);
  231. }
  232. /*
  233. * Note: in order to allow the smbmount process to open the
  234. * mount point, we only revalidate if the connection is valid or
  235. * if the process is trying to access something other than the root.
  236. */
  237. if (server->state == CONN_VALID || !IS_ROOT(dentry))
  238. error = smb_revalidate_inode(dentry);
  239. unlock_kernel();
  240. return error;
  241. }
  242. /*
  243. * Dentry operations routines
  244. */
  245. static int smb_lookup_validate(struct dentry *, struct nameidata *);
  246. static int smb_hash_dentry(struct dentry *, struct qstr *);
  247. static int smb_compare_dentry(struct dentry *, struct qstr *, struct qstr *);
  248. static int smb_delete_dentry(struct dentry *);
  249. static const struct dentry_operations smbfs_dentry_operations =
  250. {
  251. .d_revalidate = smb_lookup_validate,
  252. .d_hash = smb_hash_dentry,
  253. .d_compare = smb_compare_dentry,
  254. .d_delete = smb_delete_dentry,
  255. };
  256. static const struct dentry_operations smbfs_dentry_operations_case =
  257. {
  258. .d_revalidate = smb_lookup_validate,
  259. .d_delete = smb_delete_dentry,
  260. };
  261. /*
  262. * This is the callback when the dcache has a lookup hit.
  263. */
  264. static int
  265. smb_lookup_validate(struct dentry * dentry, struct nameidata *nd)
  266. {
  267. struct smb_sb_info *server = server_from_dentry(dentry);
  268. struct inode * inode = dentry->d_inode;
  269. unsigned long age = jiffies - dentry->d_time;
  270. int valid;
  271. /*
  272. * The default validation is based on dentry age:
  273. * we believe in dentries for a few seconds. (But each
  274. * successful server lookup renews the timestamp.)
  275. */
  276. valid = (age <= SMB_MAX_AGE(server));
  277. #ifdef SMBFS_DEBUG_VERBOSE
  278. if (!valid)
  279. VERBOSE("%s/%s not valid, age=%lu\n",
  280. DENTRY_PATH(dentry), age);
  281. #endif
  282. if (inode) {
  283. lock_kernel();
  284. if (is_bad_inode(inode)) {
  285. PARANOIA("%s/%s has dud inode\n", DENTRY_PATH(dentry));
  286. valid = 0;
  287. } else if (!valid)
  288. valid = (smb_revalidate_inode(dentry) == 0);
  289. unlock_kernel();
  290. } else {
  291. /*
  292. * What should we do for negative dentries?
  293. */
  294. }
  295. return valid;
  296. }
  297. static int
  298. smb_hash_dentry(struct dentry *dir, struct qstr *this)
  299. {
  300. unsigned long hash;
  301. int i;
  302. hash = init_name_hash();
  303. for (i=0; i < this->len ; i++)
  304. hash = partial_name_hash(tolower(this->name[i]), hash);
  305. this->hash = end_name_hash(hash);
  306. return 0;
  307. }
  308. static int
  309. smb_compare_dentry(struct dentry *dir, struct qstr *a, struct qstr *b)
  310. {
  311. int i, result = 1;
  312. if (a->len != b->len)
  313. goto out;
  314. for (i=0; i < a->len; i++) {
  315. if (tolower(a->name[i]) != tolower(b->name[i]))
  316. goto out;
  317. }
  318. result = 0;
  319. out:
  320. return result;
  321. }
  322. /*
  323. * This is the callback from dput() when d_count is going to 0.
  324. * We use this to unhash dentries with bad inodes.
  325. */
  326. static int
  327. smb_delete_dentry(struct dentry * dentry)
  328. {
  329. if (dentry->d_inode) {
  330. if (is_bad_inode(dentry->d_inode)) {
  331. PARANOIA("bad inode, unhashing %s/%s\n",
  332. DENTRY_PATH(dentry));
  333. return 1;
  334. }
  335. } else {
  336. /* N.B. Unhash negative dentries? */
  337. }
  338. return 0;
  339. }
  340. /*
  341. * Initialize a new dentry
  342. */
  343. void
  344. smb_new_dentry(struct dentry *dentry)
  345. {
  346. struct smb_sb_info *server = server_from_dentry(dentry);
  347. if (server->mnt->flags & SMB_MOUNT_CASE)
  348. dentry->d_op = &smbfs_dentry_operations_case;
  349. else
  350. dentry->d_op = &smbfs_dentry_operations;
  351. dentry->d_time = jiffies;
  352. }
  353. /*
  354. * Whenever a lookup succeeds, we know the parent directories
  355. * are all valid, so we want to update the dentry timestamps.
  356. * N.B. Move this to dcache?
  357. */
  358. void
  359. smb_renew_times(struct dentry * dentry)
  360. {
  361. dget(dentry);
  362. spin_lock(&dentry->d_lock);
  363. for (;;) {
  364. struct dentry *parent;
  365. dentry->d_time = jiffies;
  366. if (IS_ROOT(dentry))
  367. break;
  368. parent = dentry->d_parent;
  369. dget(parent);
  370. spin_unlock(&dentry->d_lock);
  371. dput(dentry);
  372. dentry = parent;
  373. spin_lock(&dentry->d_lock);
  374. }
  375. spin_unlock(&dentry->d_lock);
  376. dput(dentry);
  377. }
  378. static struct dentry *
  379. smb_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
  380. {
  381. struct smb_fattr finfo;
  382. struct inode *inode;
  383. int error;
  384. struct smb_sb_info *server;
  385. error = -ENAMETOOLONG;
  386. if (dentry->d_name.len > SMB_MAXNAMELEN)
  387. goto out;
  388. /* Do not allow lookup of names with backslashes in */
  389. error = -EINVAL;
  390. if (memchr(dentry->d_name.name, '\\', dentry->d_name.len))
  391. goto out;
  392. lock_kernel();
  393. error = smb_proc_getattr(dentry, &finfo);
  394. #ifdef SMBFS_PARANOIA
  395. if (error && error != -ENOENT)
  396. PARANOIA("find %s/%s failed, error=%d\n",
  397. DENTRY_PATH(dentry), error);
  398. #endif
  399. inode = NULL;
  400. if (error == -ENOENT)
  401. goto add_entry;
  402. if (!error) {
  403. error = -EACCES;
  404. finfo.f_ino = iunique(dentry->d_sb, 2);
  405. inode = smb_iget(dir->i_sb, &finfo);
  406. if (inode) {
  407. add_entry:
  408. server = server_from_dentry(dentry);
  409. if (server->mnt->flags & SMB_MOUNT_CASE)
  410. dentry->d_op = &smbfs_dentry_operations_case;
  411. else
  412. dentry->d_op = &smbfs_dentry_operations;
  413. d_add(dentry, inode);
  414. smb_renew_times(dentry);
  415. error = 0;
  416. }
  417. }
  418. unlock_kernel();
  419. out:
  420. return ERR_PTR(error);
  421. }
  422. /*
  423. * This code is common to all routines creating a new inode.
  424. */
  425. static int
  426. smb_instantiate(struct dentry *dentry, __u16 fileid, int have_id)
  427. {
  428. struct smb_sb_info *server = server_from_dentry(dentry);
  429. struct inode *inode;
  430. int error;
  431. struct smb_fattr fattr;
  432. VERBOSE("file %s/%s, fileid=%u\n", DENTRY_PATH(dentry), fileid);
  433. error = smb_proc_getattr(dentry, &fattr);
  434. if (error)
  435. goto out_close;
  436. smb_renew_times(dentry);
  437. fattr.f_ino = iunique(dentry->d_sb, 2);
  438. inode = smb_iget(dentry->d_sb, &fattr);
  439. if (!inode)
  440. goto out_no_inode;
  441. if (have_id) {
  442. struct smb_inode_info *ei = SMB_I(inode);
  443. ei->fileid = fileid;
  444. ei->access = SMB_O_RDWR;
  445. ei->open = server->generation;
  446. }
  447. d_instantiate(dentry, inode);
  448. out:
  449. return error;
  450. out_no_inode:
  451. error = -EACCES;
  452. out_close:
  453. if (have_id) {
  454. PARANOIA("%s/%s failed, error=%d, closing %u\n",
  455. DENTRY_PATH(dentry), error, fileid);
  456. smb_close_fileid(dentry, fileid);
  457. }
  458. goto out;
  459. }
  460. /* N.B. How should the mode argument be used? */
  461. static int
  462. smb_create(struct inode *dir, struct dentry *dentry, int mode,
  463. struct nameidata *nd)
  464. {
  465. struct smb_sb_info *server = server_from_dentry(dentry);
  466. __u16 fileid;
  467. int error;
  468. struct iattr attr;
  469. VERBOSE("creating %s/%s, mode=%d\n", DENTRY_PATH(dentry), mode);
  470. lock_kernel();
  471. smb_invalid_dir_cache(dir);
  472. error = smb_proc_create(dentry, 0, get_seconds(), &fileid);
  473. if (!error) {
  474. if (server->opt.capabilities & SMB_CAP_UNIX) {
  475. /* Set attributes for new file */
  476. attr.ia_valid = ATTR_MODE;
  477. attr.ia_mode = mode;
  478. error = smb_proc_setattr_unix(dentry, &attr, 0, 0);
  479. }
  480. error = smb_instantiate(dentry, fileid, 1);
  481. } else {
  482. PARANOIA("%s/%s failed, error=%d\n",
  483. DENTRY_PATH(dentry), error);
  484. }
  485. unlock_kernel();
  486. return error;
  487. }
  488. /* N.B. How should the mode argument be used? */
  489. static int
  490. smb_mkdir(struct inode *dir, struct dentry *dentry, int mode)
  491. {
  492. struct smb_sb_info *server = server_from_dentry(dentry);
  493. int error;
  494. struct iattr attr;
  495. lock_kernel();
  496. smb_invalid_dir_cache(dir);
  497. error = smb_proc_mkdir(dentry);
  498. if (!error) {
  499. if (server->opt.capabilities & SMB_CAP_UNIX) {
  500. /* Set attributes for new directory */
  501. attr.ia_valid = ATTR_MODE;
  502. attr.ia_mode = mode;
  503. error = smb_proc_setattr_unix(dentry, &attr, 0, 0);
  504. }
  505. error = smb_instantiate(dentry, 0, 0);
  506. }
  507. unlock_kernel();
  508. return error;
  509. }
  510. static int
  511. smb_rmdir(struct inode *dir, struct dentry *dentry)
  512. {
  513. struct inode *inode = dentry->d_inode;
  514. int error;
  515. /*
  516. * Close the directory if it's open.
  517. */
  518. lock_kernel();
  519. smb_close(inode);
  520. /*
  521. * Check that nobody else is using the directory..
  522. */
  523. error = -EBUSY;
  524. if (!d_unhashed(dentry))
  525. goto out;
  526. smb_invalid_dir_cache(dir);
  527. error = smb_proc_rmdir(dentry);
  528. out:
  529. unlock_kernel();
  530. return error;
  531. }
  532. static int
  533. smb_unlink(struct inode *dir, struct dentry *dentry)
  534. {
  535. int error;
  536. /*
  537. * Close the file if it's open.
  538. */
  539. lock_kernel();
  540. smb_close(dentry->d_inode);
  541. smb_invalid_dir_cache(dir);
  542. error = smb_proc_unlink(dentry);
  543. if (!error)
  544. smb_renew_times(dentry);
  545. unlock_kernel();
  546. return error;
  547. }
  548. static int
  549. smb_rename(struct inode *old_dir, struct dentry *old_dentry,
  550. struct inode *new_dir, struct dentry *new_dentry)
  551. {
  552. int error;
  553. /*
  554. * Close any open files, and check whether to delete the
  555. * target before attempting the rename.
  556. */
  557. lock_kernel();
  558. if (old_dentry->d_inode)
  559. smb_close(old_dentry->d_inode);
  560. if (new_dentry->d_inode) {
  561. smb_close(new_dentry->d_inode);
  562. error = smb_proc_unlink(new_dentry);
  563. if (error) {
  564. VERBOSE("unlink %s/%s, error=%d\n",
  565. DENTRY_PATH(new_dentry), error);
  566. goto out;
  567. }
  568. /* FIXME */
  569. d_delete(new_dentry);
  570. }
  571. smb_invalid_dir_cache(old_dir);
  572. smb_invalid_dir_cache(new_dir);
  573. error = smb_proc_mv(old_dentry, new_dentry);
  574. if (!error) {
  575. smb_renew_times(old_dentry);
  576. smb_renew_times(new_dentry);
  577. }
  578. out:
  579. unlock_kernel();
  580. return error;
  581. }
  582. /*
  583. * FIXME: samba servers won't let you create device nodes unless uid/gid
  584. * matches the connection credentials (and we don't know which those are ...)
  585. */
  586. static int
  587. smb_make_node(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
  588. {
  589. int error;
  590. struct iattr attr;
  591. attr.ia_valid = ATTR_MODE | ATTR_UID | ATTR_GID;
  592. attr.ia_mode = mode;
  593. current_euid_egid(&attr.ia_uid, &attr.ia_gid);
  594. if (!new_valid_dev(dev))
  595. return -EINVAL;
  596. smb_invalid_dir_cache(dir);
  597. error = smb_proc_setattr_unix(dentry, &attr, MAJOR(dev), MINOR(dev));
  598. if (!error) {
  599. error = smb_instantiate(dentry, 0, 0);
  600. }
  601. return error;
  602. }
  603. /*
  604. * dentry = existing file
  605. * new_dentry = new file
  606. */
  607. static int
  608. smb_link(struct dentry *dentry, struct inode *dir, struct dentry *new_dentry)
  609. {
  610. int error;
  611. DEBUG1("smb_link old=%s/%s new=%s/%s\n",
  612. DENTRY_PATH(dentry), DENTRY_PATH(new_dentry));
  613. smb_invalid_dir_cache(dir);
  614. error = smb_proc_link(server_from_dentry(dentry), dentry, new_dentry);
  615. if (!error) {
  616. smb_renew_times(dentry);
  617. error = smb_instantiate(new_dentry, 0, 0);
  618. }
  619. return error;
  620. }