porting.rst 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363
  1. ====================
  2. Changes since 2.5.0:
  3. ====================
  4. ---
  5. **recommended**
  6. New helpers: sb_bread(), sb_getblk(), sb_find_get_block(), set_bh(),
  7. sb_set_blocksize() and sb_min_blocksize().
  8. Use them.
  9. (sb_find_get_block() replaces 2.4's get_hash_table())
  10. ---
  11. **recommended**
  12. New methods: ->alloc_inode() and ->destroy_inode().
  13. Remove inode->u.foo_inode_i
  14. Declare::
  15. struct foo_inode_info {
  16. /* fs-private stuff */
  17. struct inode vfs_inode;
  18. };
  19. static inline struct foo_inode_info *FOO_I(struct inode *inode)
  20. {
  21. return list_entry(inode, struct foo_inode_info, vfs_inode);
  22. }
  23. Use FOO_I(inode) instead of &inode->u.foo_inode_i;
  24. Add foo_alloc_inode() and foo_destroy_inode() - the former should allocate
  25. foo_inode_info and return the address of ->vfs_inode, the latter should free
  26. FOO_I(inode) (see in-tree filesystems for examples).
  27. Make them ->alloc_inode and ->destroy_inode in your super_operations.
  28. Keep in mind that now you need explicit initialization of private data
  29. typically between calling iget_locked() and unlocking the inode.
  30. At some point that will become mandatory.
  31. **mandatory**
  32. The foo_inode_info should always be allocated through alloc_inode_sb() rather
  33. than kmem_cache_alloc() or kmalloc() related to set up the inode reclaim context
  34. correctly.
  35. ---
  36. **mandatory**
  37. Change of file_system_type method (->read_super to ->get_sb)
  38. ->read_super() is no more. Ditto for DECLARE_FSTYPE and DECLARE_FSTYPE_DEV.
  39. Turn your foo_read_super() into a function that would return 0 in case of
  40. success and negative number in case of error (-EINVAL unless you have more
  41. informative error value to report). Call it foo_fill_super(). Now declare::
  42. int foo_get_sb(struct file_system_type *fs_type,
  43. int flags, const char *dev_name, void *data, struct vfsmount *mnt)
  44. {
  45. return get_sb_bdev(fs_type, flags, dev_name, data, foo_fill_super,
  46. mnt);
  47. }
  48. (or similar with s/bdev/nodev/ or s/bdev/single/, depending on the kind of
  49. filesystem).
  50. Replace DECLARE_FSTYPE... with explicit initializer and have ->get_sb set as
  51. foo_get_sb.
  52. ---
  53. **mandatory**
  54. Locking change: ->s_vfs_rename_sem is taken only by cross-directory renames.
  55. Most likely there is no need to change anything, but if you relied on
  56. global exclusion between renames for some internal purpose - you need to
  57. change your internal locking. Otherwise exclusion warranties remain the
  58. same (i.e. parents and victim are locked, etc.).
  59. ---
  60. **informational**
  61. Now we have the exclusion between ->lookup() and directory removal (by
  62. ->rmdir() and ->rename()). If you used to need that exclusion and do
  63. it by internal locking (most of filesystems couldn't care less) - you
  64. can relax your locking.
  65. ---
  66. **mandatory**
  67. ->lookup(), ->truncate(), ->create(), ->unlink(), ->mknod(), ->mkdir(),
  68. ->rmdir(), ->link(), ->lseek(), ->symlink(), ->rename()
  69. and ->readdir() are called without BKL now. Grab it on entry, drop upon return
  70. - that will guarantee the same locking you used to have. If your method or its
  71. parts do not need BKL - better yet, now you can shift lock_kernel() and
  72. unlock_kernel() so that they would protect exactly what needs to be
  73. protected.
  74. ---
  75. **mandatory**
  76. BKL is also moved from around sb operations. BKL should have been shifted into
  77. individual fs sb_op functions. If you don't need it, remove it.
  78. ---
  79. **informational**
  80. check for ->link() target not being a directory is done by callers. Feel
  81. free to drop it...
  82. ---
  83. **informational**
  84. ->link() callers hold ->i_mutex on the object we are linking to. Some of your
  85. problems might be over...
  86. ---
  87. **mandatory**
  88. new file_system_type method - kill_sb(superblock). If you are converting
  89. an existing filesystem, set it according to ->fs_flags::
  90. FS_REQUIRES_DEV - kill_block_super
  91. FS_LITTER - kill_litter_super
  92. neither - kill_anon_super
  93. FS_LITTER is gone - just remove it from fs_flags.
  94. ---
  95. **mandatory**
  96. FS_SINGLE is gone (actually, that had happened back when ->get_sb()
  97. went in - and hadn't been documented ;-/). Just remove it from fs_flags
  98. (and see ->get_sb() entry for other actions).
  99. ---
  100. **mandatory**
  101. ->setattr() is called without BKL now. Caller _always_ holds ->i_mutex, so
  102. watch for ->i_mutex-grabbing code that might be used by your ->setattr().
  103. Callers of notify_change() need ->i_mutex now.
  104. ---
  105. **recommended**
  106. New super_block field ``struct export_operations *s_export_op`` for
  107. explicit support for exporting, e.g. via NFS. The structure is fully
  108. documented at its declaration in include/linux/fs.h, and in
  109. Documentation/filesystems/nfs/exporting.rst.
  110. Briefly it allows for the definition of decode_fh and encode_fh operations
  111. to encode and decode filehandles, and allows the filesystem to use
  112. a standard helper function for decode_fh, and provide file-system specific
  113. support for this helper, particularly get_parent.
  114. It is planned that this will be required for exporting once the code
  115. settles down a bit.
  116. **mandatory**
  117. s_export_op is now required for exporting a filesystem.
  118. isofs, ext2, ext3, fat
  119. can be used as examples of very different filesystems.
  120. ---
  121. **mandatory**
  122. iget4() and the read_inode2 callback have been superseded by iget5_locked()
  123. which has the following prototype::
  124. struct inode *iget5_locked(struct super_block *sb, unsigned long ino,
  125. int (*test)(struct inode *, void *),
  126. int (*set)(struct inode *, void *),
  127. void *data);
  128. 'test' is an additional function that can be used when the inode
  129. number is not sufficient to identify the actual file object. 'set'
  130. should be a non-blocking function that initializes those parts of a
  131. newly created inode to allow the test function to succeed. 'data' is
  132. passed as an opaque value to both test and set functions.
  133. When the inode has been created by iget5_locked(), it will be returned with the
  134. I_NEW flag set and will still be locked. The filesystem then needs to finalize
  135. the initialization. Once the inode is initialized it must be unlocked by
  136. calling unlock_new_inode().
  137. The filesystem is responsible for setting (and possibly testing) i_ino
  138. when appropriate. There is also a simpler iget_locked function that
  139. just takes the superblock and inode number as arguments and does the
  140. test and set for you.
  141. e.g.::
  142. inode = iget_locked(sb, ino);
  143. if (inode_state_read_once(inode) & I_NEW) {
  144. err = read_inode_from_disk(inode);
  145. if (err < 0) {
  146. iget_failed(inode);
  147. return err;
  148. }
  149. unlock_new_inode(inode);
  150. }
  151. Note that if the process of setting up a new inode fails, then iget_failed()
  152. should be called on the inode to render it dead, and an appropriate error
  153. should be passed back to the caller.
  154. ---
  155. **recommended**
  156. ->getattr() finally getting used. See instances in nfs, minix, etc.
  157. ---
  158. **mandatory**
  159. ->revalidate() is gone. If your filesystem had it - provide ->getattr()
  160. and let it call whatever you had as ->revlidate() + (for symlinks that
  161. had ->revalidate()) add calls in ->follow_link()/->readlink().
  162. ---
  163. **mandatory**
  164. ->d_parent changes are not protected by BKL anymore. Read access is safe
  165. if at least one of the following is true:
  166. * filesystem has no cross-directory rename()
  167. * we know that parent had been locked (e.g. we are looking at
  168. ->d_parent of ->lookup() argument).
  169. * we are called from ->rename().
  170. * the child's ->d_lock is held
  171. Audit your code and add locking if needed. Notice that any place that is
  172. not protected by the conditions above is risky even in the old tree - you
  173. had been relying on BKL and that's prone to screwups. Old tree had quite
  174. a few holes of that kind - unprotected access to ->d_parent leading to
  175. anything from oops to silent memory corruption.
  176. ---
  177. **mandatory**
  178. FS_NOMOUNT is gone. If you use it - just set SB_NOUSER in flags
  179. (see rootfs for one kind of solution and bdev/socket/pipe for another).
  180. ---
  181. **recommended**
  182. Use bdev_read_only(bdev) instead of is_read_only(kdev). The latter
  183. is still alive, but only because of the mess in drivers/s390/block/dasd.c.
  184. As soon as it gets fixed is_read_only() will die.
  185. ---
  186. **mandatory**
  187. ->permission() is called without BKL now. Grab it on entry, drop upon
  188. return - that will guarantee the same locking you used to have. If
  189. your method or its parts do not need BKL - better yet, now you can
  190. shift lock_kernel() and unlock_kernel() so that they would protect
  191. exactly what needs to be protected.
  192. ---
  193. **mandatory**
  194. ->statfs() is now called without BKL held. BKL should have been
  195. shifted into individual fs sb_op functions where it's not clear that
  196. it's safe to remove it. If you don't need it, remove it.
  197. ---
  198. **mandatory**
  199. is_read_only() is gone; use bdev_read_only() instead.
  200. ---
  201. **mandatory**
  202. destroy_buffers() is gone; use invalidate_bdev().
  203. ---
  204. **mandatory**
  205. fsync_dev() is gone; use fsync_bdev(). NOTE: lvm breakage is
  206. deliberate; as soon as struct block_device * is propagated in a reasonable
  207. way by that code fixing will become trivial; until then nothing can be
  208. done.
  209. **mandatory**
  210. block truncation on error exit from ->write_begin, and ->direct_IO
  211. moved from generic methods (block_write_begin, cont_write_begin,
  212. nobh_write_begin, blockdev_direct_IO*) to callers. Take a look at
  213. ext2_write_failed and callers for an example.
  214. **mandatory**
  215. ->truncate is gone. The whole truncate sequence needs to be
  216. implemented in ->setattr, which is now mandatory for filesystems
  217. implementing on-disk size changes. Start with a copy of the old inode_setattr
  218. and vmtruncate, and the reorder the vmtruncate + foofs_vmtruncate sequence to
  219. be in order of zeroing blocks using block_truncate_page or similar helpers,
  220. size update and on finally on-disk truncation which should not fail.
  221. setattr_prepare (which used to be inode_change_ok) now includes the size checks
  222. for ATTR_SIZE and must be called in the beginning of ->setattr unconditionally.
  223. **mandatory**
  224. ->clear_inode() and ->delete_inode() are gone; ->evict_inode() should
  225. be used instead. It gets called whenever the inode is evicted, whether it has
  226. remaining links or not. Caller does *not* evict the pagecache or inode-associated
  227. metadata buffers; the method has to use truncate_inode_pages_final() to get rid
  228. of those. Caller makes sure async writeback cannot be running for the inode while
  229. (or after) ->evict_inode() is called.
  230. ->drop_inode() returns int now; it's called on final iput() with
  231. inode->i_lock held and it returns true if filesystems wants the inode to be
  232. dropped. As before, inode_generic_drop() is still the default and it's been
  233. updated appropriately. inode_just_drop() is also alive and it consists
  234. simply of return 1. Note that all actual eviction work is done by caller after
  235. ->drop_inode() returns.
  236. As before, clear_inode() must be called exactly once on each call of
  237. ->evict_inode() (as it used to be for each call of ->delete_inode()). Unlike
  238. before, if you are using inode-associated metadata buffers (i.e.
  239. mark_buffer_dirty_inode()), it's your responsibility to call
  240. invalidate_inode_buffers() before clear_inode().
  241. NOTE: checking i_nlink in the beginning of ->write_inode() and bailing out
  242. if it's zero is not *and* *never* *had* *been* enough. Final unlink() and iput()
  243. may happen while the inode is in the middle of ->write_inode(); e.g. if you blindly
  244. free the on-disk inode, you may end up doing that while ->write_inode() is writing
  245. to it.
  246. ---
  247. **mandatory**
  248. .d_delete() now only advises the dcache as to whether or not to cache
  249. unreferenced dentries, and is now only called when the dentry refcount goes to
  250. 0. Even on 0 refcount transition, it must be able to tolerate being called 0,
  251. 1, or more times (eg. constant, idempotent).
  252. ---
  253. **mandatory**
  254. .d_compare() calling convention and locking rules are significantly
  255. changed. Read updated documentation in Documentation/filesystems/vfs.rst (and
  256. look at examples of other filesystems) for guidance.
  257. ---
  258. **mandatory**
  259. .d_hash() calling convention and locking rules are significantly
  260. changed. Read updated documentation in Documentation/filesystems/vfs.rst (and
  261. look at examples of other filesystems) for guidance.
  262. ---
  263. **mandatory**
  264. dcache_lock is gone, replaced by fine grained locks. See fs/dcache.c
  265. for details of what locks to replace dcache_lock with in order to protect
  266. particular things. Most of the time, a filesystem only needs ->d_lock, which
  267. protects *all* the dcache state of a given dentry.
  268. ---
  269. **mandatory**
  270. Filesystems must RCU-free their inodes, if they can have been accessed
  271. via rcu-walk path walk (basically, if the file can have had a path name in the
  272. vfs namespace).
  273. Even though i_dentry and i_rcu share storage in a union, we will
  274. initialize the former in inode_init_always(), so just leave it alone in
  275. the callback. It used to be necessary to clean it there, but not anymore
  276. (starting at 3.2).
  277. ---
  278. **recommended**
  279. vfs now tries to do path walking in "rcu-walk mode", which avoids
  280. atomic operations and scalability hazards on dentries and inodes (see
  281. Documentation/filesystems/path-lookup.txt). d_hash and d_compare changes
  282. (above) are examples of the changes required to support this. For more complex
  283. filesystem callbacks, the vfs drops out of rcu-walk mode before the fs call, so
  284. no changes are required to the filesystem. However, this is costly and loses
  285. the benefits of rcu-walk mode. We will begin to add filesystem callbacks that
  286. are rcu-walk aware, shown below. Filesystems should take advantage of this
  287. where possible.
  288. ---
  289. **mandatory**
  290. d_revalidate is a callback that is made on every path element (if
  291. the filesystem provides it), which requires dropping out of rcu-walk mode. This
  292. may now be called in rcu-walk mode (nd->flags & LOOKUP_RCU). -ECHILD should be
  293. returned if the filesystem cannot handle rcu-walk. See
  294. Documentation/filesystems/vfs.rst for more details.
  295. permission is an inode permission check that is called on many or all
  296. directory inodes on the way down a path walk (to check for exec permission). It
  297. must now be rcu-walk aware (mask & MAY_NOT_BLOCK). See
  298. Documentation/filesystems/vfs.rst for more details.
  299. ---
  300. **mandatory**
  301. In ->fallocate() you must check the mode option passed in. If your
  302. filesystem does not support hole punching (deallocating space in the middle of a
  303. file) you must return -EOPNOTSUPP if FALLOC_FL_PUNCH_HOLE is set in mode.
  304. Currently you can only have FALLOC_FL_PUNCH_HOLE with FALLOC_FL_KEEP_SIZE set,
  305. so the i_size should not change when hole punching, even when puching the end of
  306. a file off.
  307. ---
  308. **mandatory**
  309. ->get_sb() and ->mount() are gone. Switch to using the new mount API. See
  310. Documentation/filesystems/mount_api.rst for more details.
  311. ---
  312. **mandatory**
  313. ->permission() and generic_permission()have lost flags
  314. argument; instead of passing IPERM_FLAG_RCU we add MAY_NOT_BLOCK into mask.
  315. generic_permission() has also lost the check_acl argument; ACL checking
  316. has been taken to VFS and filesystems need to provide a non-NULL
  317. ->i_op->get_inode_acl to read an ACL from disk.
  318. ---
  319. **mandatory**
  320. If you implement your own ->llseek() you must handle SEEK_HOLE and
  321. SEEK_DATA. You can handle this by returning -EINVAL, but it would be nicer to
  322. support it in some way. The generic handler assumes that the entire file is
  323. data and there is a virtual hole at the end of the file. So if the provided
  324. offset is less than i_size and SEEK_DATA is specified, return the same offset.
  325. If the above is true for the offset and you are given SEEK_HOLE, return the end
  326. of the file. If the offset is i_size or greater return -ENXIO in either case.
  327. **mandatory**
  328. If you have your own ->fsync() you must make sure to call
  329. filemap_write_and_wait_range() so that all dirty pages are synced out properly.
  330. You must also keep in mind that ->fsync() is not called with i_mutex held
  331. anymore, so if you require i_mutex locking you must make sure to take it and
  332. release it yourself.
  333. ---
  334. **mandatory**
  335. d_alloc_root() is gone, along with a lot of bugs caused by code
  336. misusing it. Replacement: d_make_root(inode). On success d_make_root(inode)
  337. allocates and returns a new dentry instantiated with the passed in inode.
  338. On failure NULL is returned and the passed in inode is dropped so the reference
  339. to inode is consumed in all cases and failure handling need not do any cleanup
  340. for the inode. If d_make_root(inode) is passed a NULL inode it returns NULL
  341. and also requires no further error handling. Typical usage is::
  342. inode = foofs_new_inode(....);
  343. s->s_root = d_make_root(inode);
  344. if (!s->s_root)
  345. /* Nothing needed for the inode cleanup */
  346. return -ENOMEM;
  347. ...
  348. ---
  349. **mandatory**
  350. The witch is dead! Well, 2/3 of it, anyway. ->d_revalidate() and
  351. ->lookup() do *not* take struct nameidata anymore; just the flags.
  352. ---
  353. **mandatory**
  354. ->create() doesn't take ``struct nameidata *``; unlike the previous
  355. two, it gets "is it an O_EXCL or equivalent?" boolean argument. Note that
  356. local filesystems can ignore this argument - they are guaranteed that the
  357. object doesn't exist. It's remote/distributed ones that might care...
  358. ---
  359. **mandatory**
  360. FS_REVAL_DOT is gone; if you used to have it, add ->d_weak_revalidate()
  361. in your dentry operations instead.
  362. ---
  363. **mandatory**
  364. vfs_readdir() is gone; switch to iterate_dir() instead
  365. ---
  366. **mandatory**
  367. ->readdir() is gone now; switch to ->iterate_shared()
  368. **mandatory**
  369. vfs_follow_link has been removed. Filesystems must use nd_set_link
  370. from ->follow_link for normal symlinks, or nd_jump_link for magic
  371. /proc/<pid> style links.
  372. ---
  373. **mandatory**
  374. iget5_locked()/ilookup5()/ilookup5_nowait() test() callback used to be
  375. called with both ->i_lock and inode_hash_lock held; the former is *not*
  376. taken anymore, so verify that your callbacks do not rely on it (none
  377. of the in-tree instances did). inode_hash_lock is still held,
  378. of course, so they are still serialized wrt removal from inode hash,
  379. as well as wrt set() callback of iget5_locked().
  380. ---
  381. **mandatory**
  382. d_materialise_unique() is gone; d_splice_alias() does everything you
  383. need now. Remember that they have opposite orders of arguments ;-/
  384. ---
  385. **mandatory**
  386. f_dentry is gone; use f_path.dentry, or, better yet, see if you can avoid
  387. it entirely.
  388. ---
  389. **mandatory**
  390. never call ->read() and ->write() directly; use __vfs_{read,write} or
  391. wrappers; instead of checking for ->write or ->read being NULL, look for
  392. FMODE_CAN_{WRITE,READ} in file->f_mode.
  393. ---
  394. **mandatory**
  395. do _not_ use new_sync_{read,write} for ->read/->write; leave it NULL
  396. instead.
  397. ---
  398. **mandatory**
  399. ->aio_read/->aio_write are gone. Use ->read_iter/->write_iter.
  400. ---
  401. **recommended**
  402. for embedded ("fast") symlinks just set inode->i_link to wherever the
  403. symlink body is and use simple_follow_link() as ->follow_link().
  404. ---
  405. **mandatory**
  406. calling conventions for ->follow_link() have changed. Instead of returning
  407. cookie and using nd_set_link() to store the body to traverse, we return
  408. the body to traverse and store the cookie using explicit void ** argument.
  409. nameidata isn't passed at all - nd_jump_link() doesn't need it and
  410. nd_[gs]et_link() is gone.
  411. ---
  412. **mandatory**
  413. calling conventions for ->put_link() have changed. It gets inode instead of
  414. dentry, it does not get nameidata at all and it gets called only when cookie
  415. is non-NULL. Note that link body isn't available anymore, so if you need it,
  416. store it as cookie.
  417. ---
  418. **mandatory**
  419. any symlink that might use page_follow_link_light/page_put_link() must
  420. have inode_nohighmem(inode) called before anything might start playing with
  421. its pagecache. No highmem pages should end up in the pagecache of such
  422. symlinks. That includes any preseeding that might be done during symlink
  423. creation. page_symlink() will honour the mapping gfp flags, so once
  424. you've done inode_nohighmem() it's safe to use, but if you allocate and
  425. insert the page manually, make sure to use the right gfp flags.
  426. ---
  427. **mandatory**
  428. ->follow_link() is replaced with ->get_link(); same API, except that
  429. * ->get_link() gets inode as a separate argument
  430. * ->get_link() may be called in RCU mode - in that case NULL
  431. dentry is passed
  432. ---
  433. **mandatory**
  434. ->get_link() gets struct delayed_call ``*done`` now, and should do
  435. set_delayed_call() where it used to set ``*cookie``.
  436. ->put_link() is gone - just give the destructor to set_delayed_call()
  437. in ->get_link().
  438. ---
  439. **mandatory**
  440. ->getxattr() and xattr_handler.get() get dentry and inode passed separately.
  441. dentry might be yet to be attached to inode, so do _not_ use its ->d_inode
  442. in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
  443. called before we attach dentry to inode.
  444. ---
  445. **mandatory**
  446. symlinks are no longer the only inodes that do *not* have i_bdev/i_cdev/
  447. i_pipe/i_link union zeroed out at inode eviction. As the result, you can't
  448. assume that non-NULL value in ->i_nlink at ->destroy_inode() implies that
  449. it's a symlink. Checking ->i_mode is really needed now. In-tree we had
  450. to fix shmem_destroy_callback() that used to take that kind of shortcut;
  451. watch out, since that shortcut is no longer valid.
  452. ---
  453. **mandatory**
  454. ->i_mutex is replaced with ->i_rwsem now. inode_lock() et.al. work as
  455. they used to - they just take it exclusive. However, ->lookup() may be
  456. called with parent locked shared. Its instances must not
  457. * use d_instantiate) and d_rehash() separately - use d_add() or
  458. d_splice_alias() instead.
  459. * use d_rehash() alone - call d_add(new_dentry, NULL) instead.
  460. * in the unlikely case when (read-only) access to filesystem
  461. data structures needs exclusion for some reason, arrange it
  462. yourself. None of the in-tree filesystems needed that.
  463. * rely on ->d_parent and ->d_name not changing after dentry has
  464. been fed to d_add() or d_splice_alias(). Again, none of the
  465. in-tree instances relied upon that.
  466. We are guaranteed that lookups of the same name in the same directory
  467. will not happen in parallel ("same" in the sense of your ->d_compare()).
  468. Lookups on different names in the same directory can and do happen in
  469. parallel now.
  470. ---
  471. **mandatory**
  472. ->iterate_shared() is added.
  473. Exclusion on struct file level is still provided (as well as that
  474. between it and lseek on the same struct file), but if your directory
  475. has been opened several times, you can get these called in parallel.
  476. Exclusion between that method and all directory-modifying ones is
  477. still provided, of course.
  478. If you have any per-inode or per-dentry in-core data structures modified
  479. by ->iterate_shared(), you might need something to serialize the access
  480. to them. If you do dcache pre-seeding, you'll need to switch to
  481. d_alloc_parallel() for that; look for in-tree examples.
  482. ---
  483. **mandatory**
  484. ->atomic_open() calls without O_CREAT may happen in parallel.
  485. ---
  486. **mandatory**
  487. ->setxattr() and xattr_handler.set() get dentry and inode passed separately.
  488. The xattr_handler.set() gets passed the user namespace of the mount the inode
  489. is seen from so filesystems can idmap the i_uid and i_gid accordingly.
  490. dentry might be yet to be attached to inode, so do _not_ use its ->d_inode
  491. in the instances. Rationale: !@#!@# security_d_instantiate() needs to be
  492. called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack
  493. ->d_instantiate() uses not just ->getxattr() but ->setxattr() as well.
  494. ---
  495. **mandatory**
  496. ->d_compare() doesn't get parent as a separate argument anymore. If you
  497. used it for finding the struct super_block involved, dentry->d_sb will
  498. work just as well; if it's something more complicated, use dentry->d_parent.
  499. Just be careful not to assume that fetching it more than once will yield
  500. the same value - in RCU mode it could change under you.
  501. ---
  502. **mandatory**
  503. ->rename() has an added flags argument. Any flags not handled by the
  504. filesystem should result in EINVAL being returned.
  505. ---
  506. **recommended**
  507. ->readlink is optional for symlinks. Don't set, unless filesystem needs
  508. to fake something for readlink(2).
  509. ---
  510. **mandatory**
  511. ->getattr() is now passed a struct path rather than a vfsmount and
  512. dentry separately, and it now has request_mask and query_flags arguments
  513. to specify the fields and sync type requested by statx. Filesystems not
  514. supporting any statx-specific features may ignore the new arguments.
  515. ---
  516. **mandatory**
  517. ->atomic_open() calling conventions have changed. Gone is ``int *opened``,
  518. along with FILE_OPENED/FILE_CREATED. In place of those we have
  519. FMODE_OPENED/FMODE_CREATED, set in file->f_mode. Additionally, return
  520. value for 'called finish_no_open(), open it yourself' case has become
  521. 0, not 1. Since finish_no_open() itself is returning 0 now, that part
  522. does not need any changes in ->atomic_open() instances.
  523. ---
  524. **mandatory**
  525. alloc_file() has become static now; two wrappers are to be used instead.
  526. alloc_file_pseudo(inode, vfsmount, name, flags, ops) is for the cases
  527. when dentry needs to be created; that's the majority of old alloc_file()
  528. users. Calling conventions: on success a reference to new struct file
  529. is returned and callers reference to inode is subsumed by that. On
  530. failure, ERR_PTR() is returned and no caller's references are affected,
  531. so the caller needs to drop the inode reference it held.
  532. alloc_file_clone(file, flags, ops) does not affect any caller's references.
  533. On success you get a new struct file sharing the mount/dentry with the
  534. original, on failure - ERR_PTR().
  535. ---
  536. **mandatory**
  537. ->clone_file_range() and ->dedupe_file_range have been replaced with
  538. ->remap_file_range(). See Documentation/filesystems/vfs.rst for more
  539. information.
  540. ---
  541. **recommended**
  542. ->lookup() instances doing an equivalent of::
  543. if (IS_ERR(inode))
  544. return ERR_CAST(inode);
  545. return d_splice_alias(inode, dentry);
  546. don't need to bother with the check - d_splice_alias() will do the
  547. right thing when given ERR_PTR(...) as inode. Moreover, passing NULL
  548. inode to d_splice_alias() will also do the right thing (equivalent of
  549. d_add(dentry, NULL); return NULL;), so that kind of special cases
  550. also doesn't need a separate treatment.
  551. ---
  552. **strongly recommended**
  553. take the RCU-delayed parts of ->destroy_inode() into a new method -
  554. ->free_inode(). If ->destroy_inode() becomes empty - all the better,
  555. just get rid of it. Synchronous work (e.g. the stuff that can't
  556. be done from an RCU callback, or any WARN_ON() where we want the
  557. stack trace) *might* be movable to ->evict_inode(); however,
  558. that goes only for the things that are not needed to balance something
  559. done by ->alloc_inode(). IOW, if it's cleaning up the stuff that
  560. might have accumulated over the life of in-core inode, ->evict_inode()
  561. might be a fit.
  562. Rules for inode destruction:
  563. * if ->destroy_inode() is non-NULL, it gets called
  564. * if ->free_inode() is non-NULL, it gets scheduled by call_rcu()
  565. * combination of NULL ->destroy_inode and NULL ->free_inode is
  566. treated as NULL/free_inode_nonrcu, to preserve the compatibility.
  567. Note that the callback (be it via ->free_inode() or explicit call_rcu()
  568. in ->destroy_inode()) is *NOT* ordered wrt superblock destruction;
  569. as the matter of fact, the superblock and all associated structures
  570. might be already gone. The filesystem driver is guaranteed to be still
  571. there, but that's it. Freeing memory in the callback is fine; doing
  572. more than that is possible, but requires a lot of care and is best
  573. avoided.
  574. ---
  575. **mandatory**
  576. DCACHE_RCUACCESS is gone; having an RCU delay on dentry freeing is the
  577. default. DCACHE_NORCU opts out, and only d_alloc_pseudo() has any
  578. business doing so.
  579. ---
  580. **mandatory**
  581. d_alloc_pseudo() is internal-only; uses outside of alloc_file_pseudo() are
  582. very suspect (and won't work in modules). Such uses are very likely to
  583. be misspelled d_alloc_anon().
  584. ---
  585. **mandatory**
  586. [should've been added in 2016] stale comment in finish_open() notwithstanding,
  587. failure exits in ->atomic_open() instances should *NOT* fput() the file,
  588. no matter what. Everything is handled by the caller.
  589. ---
  590. **mandatory**
  591. clone_private_mount() returns a longterm mount now, so the proper destructor of
  592. its result is kern_unmount() or kern_unmount_array().
  593. ---
  594. **mandatory**
  595. zero-length bvec segments are disallowed, they must be filtered out before
  596. passed on to an iterator.
  597. ---
  598. **mandatory**
  599. For bvec based itererators bio_iov_iter_get_pages() now doesn't copy bvecs but
  600. uses the one provided. Anyone issuing kiocb-I/O should ensure that the bvec and
  601. page references stay until I/O has completed, i.e. until ->ki_complete() has
  602. been called or returned with non -EIOCBQUEUED code.
  603. ---
  604. **mandatory**
  605. mnt_want_write_file() can now only be paired with mnt_drop_write_file(),
  606. whereas previously it could be paired with mnt_drop_write() as well.
  607. ---
  608. **mandatory**
  609. iov_iter_copy_from_user_atomic() is gone; use copy_page_from_iter_atomic().
  610. The difference is copy_page_from_iter_atomic() advances the iterator and
  611. you don't need iov_iter_advance() after it. However, if you decide to use
  612. only a part of obtained data, you should do iov_iter_revert().
  613. ---
  614. **mandatory**
  615. Calling conventions for file_open_root() changed; now it takes struct path *
  616. instead of passing mount and dentry separately. For callers that used to
  617. pass <mnt, mnt->mnt_root> pair (i.e. the root of given mount), a new helper
  618. is provided - file_open_root_mnt(). In-tree users adjusted.
  619. ---
  620. **mandatory**
  621. no_llseek is gone; don't set .llseek to that - just leave it NULL instead.
  622. Checks for "does that file have llseek(2), or should it fail with ESPIPE"
  623. should be done by looking at FMODE_LSEEK in file->f_mode.
  624. ---
  625. *mandatory*
  626. filldir_t (readdir callbacks) calling conventions have changed. Instead of
  627. returning 0 or -E... it returns bool now. false means "no more" (as -E... used
  628. to) and true - "keep going" (as 0 in old calling conventions). Rationale:
  629. callers never looked at specific -E... values anyway. -> iterate_shared()
  630. instances require no changes at all, all filldir_t ones in the tree
  631. converted.
  632. ---
  633. **mandatory**
  634. Calling conventions for ->tmpfile() have changed. It now takes a struct
  635. file pointer instead of struct dentry pointer. d_tmpfile() is similarly
  636. changed to simplify callers. The passed file is in a non-open state and on
  637. success must be opened before returning (e.g. by calling
  638. finish_open_simple()).
  639. ---
  640. **mandatory**
  641. Calling convention for ->huge_fault has changed. It now takes a page
  642. order instead of an enum page_entry_size, and it may be called without the
  643. mmap_lock held. All in-tree users have been audited and do not seem to
  644. depend on the mmap_lock being held, but out of tree users should verify
  645. for themselves. If they do need it, they can return VM_FAULT_RETRY to
  646. be called with the mmap_lock held.
  647. ---
  648. **mandatory**
  649. The order of opening block devices and matching or creating superblocks has
  650. changed.
  651. The old logic opened block devices first and then tried to find a
  652. suitable superblock to reuse based on the block device pointer.
  653. The new logic tries to find a suitable superblock first based on the device
  654. number, and opening the block device afterwards.
  655. Since opening block devices cannot happen under s_umount because of lock
  656. ordering requirements s_umount is now dropped while opening block devices and
  657. reacquired before calling fill_super().
  658. In the old logic concurrent mounters would find the superblock on the list of
  659. superblocks for the filesystem type. Since the first opener of the block device
  660. would hold s_umount they would wait until the superblock became either born or
  661. was discarded due to initialization failure.
  662. Since the new logic drops s_umount concurrent mounters could grab s_umount and
  663. would spin. Instead they are now made to wait using an explicit wait-wake
  664. mechanism without having to hold s_umount.
  665. ---
  666. **mandatory**
  667. The holder of a block device is now the superblock.
  668. The holder of a block device used to be the file_system_type which wasn't
  669. particularly useful. It wasn't possible to go from block device to owning
  670. superblock without matching on the device pointer stored in the superblock.
  671. This mechanism would only work for a single device so the block layer couldn't
  672. find the owning superblock of any additional devices.
  673. In the old mechanism reusing or creating a superblock for a racing mount(2) and
  674. umount(2) relied on the file_system_type as the holder. This was severely
  675. underdocumented however:
  676. (1) Any concurrent mounter that managed to grab an active reference on an
  677. existing superblock was made to wait until the superblock either became
  678. ready or until the superblock was removed from the list of superblocks of
  679. the filesystem type. If the superblock is ready the caller would simple
  680. reuse it.
  681. (2) If the mounter came after deactivate_locked_super() but before
  682. the superblock had been removed from the list of superblocks of the
  683. filesystem type the mounter would wait until the superblock was shutdown,
  684. reuse the block device and allocate a new superblock.
  685. (3) If the mounter came after deactivate_locked_super() and after
  686. the superblock had been removed from the list of superblocks of the
  687. filesystem type the mounter would reuse the block device and allocate a new
  688. superblock (the bd_holder point may still be set to the filesystem type).
  689. Because the holder of the block device was the file_system_type any concurrent
  690. mounter could open the block devices of any superblock of the same
  691. file_system_type without risking seeing EBUSY because the block device was
  692. still in use by another superblock.
  693. Making the superblock the owner of the block device changes this as the holder
  694. is now a unique superblock and thus block devices associated with it cannot be
  695. reused by concurrent mounters. So a concurrent mounter in (2) could suddenly
  696. see EBUSY when trying to open a block device whose holder was a different
  697. superblock.
  698. The new logic thus waits until the superblock and the devices are shutdown in
  699. ->kill_sb(). Removal of the superblock from the list of superblocks of the
  700. filesystem type is now moved to a later point when the devices are closed:
  701. (1) Any concurrent mounter managing to grab an active reference on an existing
  702. superblock is made to wait until the superblock is either ready or until
  703. the superblock and all devices are shutdown in ->kill_sb(). If the
  704. superblock is ready the caller will simply reuse it.
  705. (2) If the mounter comes after deactivate_locked_super() but before
  706. the superblock has been removed from the list of superblocks of the
  707. filesystem type the mounter is made to wait until the superblock and the
  708. devices are shut down in ->kill_sb() and the superblock is removed from the
  709. list of superblocks of the filesystem type. The mounter will allocate a new
  710. superblock and grab ownership of the block device (the bd_holder pointer of
  711. the block device will be set to the newly allocated superblock).
  712. (3) This case is now collapsed into (2) as the superblock is left on the list
  713. of superblocks of the filesystem type until all devices are shutdown in
  714. ->kill_sb(). In other words, if the superblock isn't on the list of
  715. superblock of the filesystem type anymore then it has given up ownership of
  716. all associated block devices (the bd_holder pointer is NULL).
  717. As this is a VFS level change it has no practical consequences for filesystems
  718. other than that all of them must use one of the provided kill_litter_super(),
  719. kill_anon_super(), or kill_block_super() helpers.
  720. ---
  721. **mandatory**
  722. Lock ordering has been changed so that s_umount ranks above open_mutex again.
  723. All places where s_umount was taken under open_mutex have been fixed up.
  724. ---
  725. **mandatory**
  726. export_operations ->encode_fh() no longer has a default implementation to
  727. encode FILEID_INO32_GEN* file handles.
  728. Filesystems that used the default implementation may use the generic helper
  729. generic_encode_ino32_fh() explicitly.
  730. ---
  731. **mandatory**
  732. If ->rename() update of .. on cross-directory move needs an exclusion with
  733. directory modifications, do *not* lock the subdirectory in question in your
  734. ->rename() - it's done by the caller now [that item should've been added in
  735. 28eceeda130f "fs: Lock moved directories"].
  736. ---
  737. **mandatory**
  738. On same-directory ->rename() the (tautological) update of .. is not protected
  739. by any locks; just don't do it if the old parent is the same as the new one.
  740. We really can't lock two subdirectories in same-directory rename - not without
  741. deadlocks.
  742. ---
  743. **mandatory**
  744. lock_rename() and lock_rename_child() may fail in cross-directory case, if
  745. their arguments do not have a common ancestor. In that case ERR_PTR(-EXDEV)
  746. is returned, with no locks taken. In-tree users updated; out-of-tree ones
  747. would need to do so.
  748. ---
  749. **mandatory**
  750. The list of children anchored in parent dentry got turned into hlist now.
  751. Field names got changed (->d_children/->d_sib instead of ->d_subdirs/->d_child
  752. for anchor/entries resp.), so any affected places will be immediately caught
  753. by compiler.
  754. ---
  755. **mandatory**
  756. ->d_delete() instances are now called for dentries with ->d_lock held
  757. and refcount equal to 0. They are not permitted to drop/regain ->d_lock.
  758. None of in-tree instances did anything of that sort. Make sure yours do not...
  759. ---
  760. **mandatory**
  761. ->d_prune() instances are now called without ->d_lock held on the parent.
  762. ->d_lock on dentry itself is still held; if you need per-parent exclusions (none
  763. of the in-tree instances did), use your own spinlock.
  764. ->d_iput() and ->d_release() are called with victim dentry still in the
  765. list of parent's children. It is still unhashed, marked killed, etc., just not
  766. removed from parent's ->d_children yet.
  767. Anyone iterating through the list of children needs to be aware of the
  768. half-killed dentries that might be seen there; taking ->d_lock on those will
  769. see them negative, unhashed and with negative refcount, which means that most
  770. of the in-kernel users would've done the right thing anyway without any adjustment.
  771. ---
  772. **recommended**
  773. Block device freezing and thawing have been moved to holder operations.
  774. Before this change, get_active_super() would only be able to find the
  775. superblock of the main block device, i.e., the one stored in sb->s_bdev. Block
  776. device freezing now works for any block device owned by a given superblock, not
  777. just the main block device. The get_active_super() helper and bd_fsfreeze_sb
  778. pointer are gone.
  779. ---
  780. **mandatory**
  781. set_blocksize() takes opened struct file instead of struct block_device now
  782. and it *must* be opened exclusive.
  783. ---
  784. **mandatory**
  785. ->d_revalidate() gets two extra arguments - inode of parent directory and
  786. name our dentry is expected to have. Both are stable (dir is pinned in
  787. non-RCU case and will stay around during the call in RCU case, and name
  788. is guaranteed to stay unchanging). Your instance doesn't have to use
  789. either, but it often helps to avoid a lot of painful boilerplate.
  790. Note that while name->name is stable and NUL-terminated, it may (and
  791. often will) have name->name[name->len] equal to '/' rather than '\0' -
  792. in normal case it points into the pathname being looked up.
  793. NOTE: if you need something like full path from the root of filesystem,
  794. you are still on your own - this assists with simple cases, but it's not
  795. magic.
  796. ---
  797. **recommended**
  798. kern_path_locked() and user_path_locked() no longer return a negative
  799. dentry so this doesn't need to be checked. If the name cannot be found,
  800. ERR_PTR(-ENOENT) is returned.
  801. ---
  802. **recommended**
  803. lookup_one_qstr_excl() is changed to return errors in more cases, so
  804. these conditions don't require explicit checks:
  805. - if LOOKUP_CREATE is NOT given, then the dentry won't be negative,
  806. ERR_PTR(-ENOENT) is returned instead
  807. - if LOOKUP_EXCL IS given, then the dentry won't be positive,
  808. ERR_PTR(-EEXIST) is rreturned instread
  809. LOOKUP_EXCL now means "target must not exist". It can be combined with
  810. LOOK_CREATE or LOOKUP_RENAME_TARGET.
  811. ---
  812. **mandatory**
  813. invalidate_inodes() is gone use evict_inodes() instead.
  814. ---
  815. **mandatory**
  816. ->mkdir() now returns a dentry. If the created inode is found to
  817. already be in cache and have a dentry (often IS_ROOT()), it will need to
  818. be spliced into the given name in place of the given dentry. That dentry
  819. now needs to be returned. If the original dentry is used, NULL should
  820. be returned. Any error should be returned with ERR_PTR().
  821. In general, filesystems which use d_instantiate_new() to install the new
  822. inode can safely return NULL. Filesystems which may not have an I_NEW inode
  823. should use d_drop();d_splice_alias() and return the result of the latter.
  824. If a positive dentry cannot be returned for some reason, in-kernel
  825. clients such as cachefiles, nfsd, smb/server may not perform ideally but
  826. will fail-safe.
  827. ---
  828. ** mandatory**
  829. lookup_one(), lookup_one_unlocked(), lookup_one_positive_unlocked() now
  830. take a qstr instead of a name and len. These, not the "one_len"
  831. versions, should be used whenever accessing a filesystem from outside
  832. that filesysmtem, through a mount point - which will have a mnt_idmap.
  833. ---
  834. ** mandatory**
  835. Functions try_lookup_one_len(), lookup_one_len(),
  836. lookup_one_len_unlocked() and lookup_positive_unlocked() have been
  837. renamed to try_lookup_noperm(), lookup_noperm(),
  838. lookup_noperm_unlocked(), lookup_noperm_positive_unlocked(). They now
  839. take a qstr instead of separate name and length. QSTR() can be used
  840. when strlen() is needed for the length.
  841. These function no longer do any permission checking - they previously
  842. checked that the caller has 'X' permission on the parent. They must
  843. ONLY be used internally by a filesystem on itself when it knows that
  844. permissions are irrelevant or in a context where permission checks have
  845. already been performed such as after vfs_path_parent_lookup()
  846. ---
  847. ** mandatory**
  848. d_hash_and_lookup() is no longer exported or available outside the VFS.
  849. Use try_lookup_noperm() instead. This adds name validation and takes
  850. arguments in the opposite order but is otherwise identical.
  851. Using try_lookup_noperm() will require linux/namei.h to be included.
  852. ---
  853. **mandatory**
  854. Calling conventions for ->d_automount() have changed; we should *not* grab
  855. an extra reference to new mount - it should be returned with refcount 1.
  856. ---
  857. collect_mounts()/drop_collected_mounts()/iterate_mounts() are gone now.
  858. Replacement is collect_paths()/drop_collected_path(), with no special
  859. iterator needed. Instead of a cloned mount tree, the new interface returns
  860. an array of struct path, one for each mount collect_mounts() would've
  861. created. These struct path point to locations in the caller's namespace
  862. that would be roots of the cloned mounts.
  863. ---
  864. **mandatory**
  865. If your filesystem sets the default dentry_operations, use set_default_d_op()
  866. rather than manually setting sb->s_d_op.
  867. ---
  868. **mandatory**
  869. d_set_d_op() is no longer exported (or public, for that matter); _if_
  870. your filesystem really needed that, make use of d_splice_alias_ops()
  871. to have them set. Better yet, think hard whether you need different
  872. ->d_op for different dentries - if not, just use set_default_d_op()
  873. at mount time and be done with that. Currently procfs is the only
  874. thing that really needs ->d_op varying between dentries.
  875. ---
  876. **highly recommended**
  877. The file operations mmap() callback is deprecated in favour of
  878. mmap_prepare(). This passes a pointer to a vm_area_desc to the callback
  879. rather than a VMA, as the VMA at this stage is not yet valid.
  880. The vm_area_desc provides the minimum required information for a filesystem
  881. to initialise state upon memory mapping of a file-backed region, and output
  882. parameters for the file system to set this state.
  883. In nearly all cases, this is all that is required for a filesystem. However, if
  884. a filesystem needs to perform an operation such a pre-population of page tables,
  885. then that action can be specified in the vm_area_desc->action field, which can
  886. be configured using the mmap_action_*() helpers.
  887. ---
  888. **mandatory**
  889. Several functions are renamed:
  890. - kern_path_locked -> start_removing_path
  891. - kern_path_create -> start_creating_path
  892. - user_path_create -> start_creating_user_path
  893. - user_path_locked_at -> start_removing_user_path_at
  894. - done_path_create -> end_creating_path
  895. ---
  896. **mandatory**
  897. Calling conventions for vfs_parse_fs_string() have changed; it does *not*
  898. take length anymore (value ? strlen(value) : 0 is used). If you want
  899. a different length, use
  900. vfs_parse_fs_qstr(fc, key, &QSTR_LEN(value, len))
  901. instead.
  902. ---
  903. **mandatory**
  904. vfs_mkdir() now returns a dentry - the one returned by ->mkdir(). If
  905. that dentry is different from the dentry passed in, including if it is
  906. an IS_ERR() dentry pointer, the original dentry is dput().
  907. When vfs_mkdir() returns an error, and so both dputs() the original
  908. dentry and doesn't provide a replacement, it also unlocks the parent.
  909. Consequently the return value from vfs_mkdir() can be passed to
  910. end_creating() and the parent will be unlocked precisely when necessary.
  911. ---
  912. **mandatory**
  913. kill_litter_super() is gone; convert to DCACHE_PERSISTENT use (as all
  914. in-tree filesystems have done).
  915. ---
  916. **mandatory**
  917. The ->setlease() file_operation must now be explicitly set in order to provide
  918. support for leases. When set to NULL, the kernel will now return -EINVAL to
  919. attempts to set a lease. Filesystems that wish to use the kernel-internal lease
  920. implementation should set it to generic_setlease().
  921. ---
  922. **mandatory**
  923. fs/namei.c primitives that consume filesystem references (do_renameat2(),
  924. do_linkat(), do_symlinkat(), do_mkdirat(), do_mknodat(), do_unlinkat()
  925. and do_rmdir()) are gone; they are replaced with non-consuming analogues
  926. (filename_renameat2(), etc.)
  927. Callers are adjusted - responsibility for dropping the filenames belongs
  928. to them now.
  929. ---
  930. **mandatory**
  931. readlink_copy() now requires link length as the 4th argument. Said length needs
  932. to match what strlen() would return if it was ran on the string.
  933. However, if the string is freely accessible for the duration of inode's
  934. lifetime, consider using inode_set_cached_link() instead.