Linux 4.9: inode_operation rename now takes flags 91/12391/5
authorMark Vitale <mvitale@sinenomine.net>
Fri, 16 Sep 2016 23:01:19 +0000 (19:01 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 26 Oct 2016 01:33:25 +0000 (21:33 -0400)
commitf21e3ef8ce5093b4e0578d29666f76bd99aef1a2
tree71e22cc0f8b490013a1b567e408ae02989c84202
parent8e81b182e36cde28ec5708e5fcbe56e4900b1ea3
Linux 4.9: inode_operation rename now takes flags

In Linux 3.15 commit 520c8b16505236fc82daa352e6c5e73cd9870cff,
inode_operation rename2() was added.  It takes the same arguments as
rename(), with an added flags argument supporting the following values:

RENAME_NOREPLACE: if "new" name exists, fail with -EEXIST.  Without
this flag, the default behavior is to replace the "new" existing file.

RENAME_EXCHANGE: exchange source and target; both must exist.

OpenAFS never implemented a .rename2() routine because it was optional
when introduced at Linux v3.15.

In Linux 4.9-rc1 the following commits remove the last in-tree uses of
.rename() and converts .rename2() to .rename().
aadfa8019e81 vfs: add note about i_op->rename changes to porting
2773bf00aeb9 fs: rename "rename2" i_op to "rename"
18fc84dafaac vfs: remove unused i_op->rename
1cd66c93ba8c fs: make remaining filesystems use .rename2
e0e0be8a8355 libfs: support RENAME_NOREPLACE in simple_rename()
f03b8ad8d386 fs: support RENAME_NOREPLACE for local filesystems

With these changes, it is now mandatory for OpenAFS afs_linux_rename()
to accept a 5th flag argument.

Add an autoconfig test to determine the signature of .rename().  Use this
information to implement afs_linux_rename() with the appropriate number
of arguments.  Implement "toleration support" for the flags option by
treating a zero flag as a normal rename; if any flags are specified,
return -EINVAL to indicate the OpenAFS filesystem does not yet support
any flags.

Change-Id: I165d2b7956942446d97beda8504ac1ed5185a036
Reviewed-on: https://gerrit.openafs.org/12391
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
acinclude.m4
src/afs/LINUX/osi_vnodeops.c