Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\namei.c Create Date:2022-07-28 20:05:20
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:do_renameat2

Proto:static int do_renameat2(int olddfd, const char __user *oldname, int newdfd, const char __user *newname, unsigned int flags)

Type:int

Parameter:

TypeParameterName
intolddfd
const char __user *oldname
intnewdfd
const char __user *newname
unsigned intflags
4467  struct inode * delegated_inode = NULL
4470  lookup_flags = 0 , target_flags = ... in destination of rename()
4471  bool should_retry = false
4474  If flags & ~( Don't overwrite target | Exchange source and dest | Whiteout source ) Then Return -EINVAL
4477  If flags & (Don't overwrite target | Whiteout source ) && flags & Exchange source and dest Then Return -EINVAL
4481  If flags & Whiteout source && Not Check operation authority Then Return -EPERM
4484  If flags & Exchange source and dest Then target_flags = 0
4487  retry :
4488  from = filename_parentat(olddfd, getname(oldname), lookup_flags, & old_path, & old_last, & old_type)
4490  If IS_ERR(from) Then
4491  error = PTR_ERR(from)
4492  Go to exit
4495  to = filename_parentat(newdfd, getname(newname), lookup_flags, & new_path, & new_last, & new_type)
4497  If IS_ERR(to) Then
4498  error = PTR_ERR(to)
4499  Go to exit1
4502  error = -EXDEV
4503  If mnt != mnt Then Go to exit2
4506  error = -EBUSY
4507  If old_type != LAST_NORM Then Go to exit2
4510  If flags & Don't overwrite target Then error = -EEXIST
4512  If new_type != LAST_NORM Then Go to exit2
4515  error = mnt_want_write(mnt)
4516  If error Then Go to exit2
4519  retry_deleg :
4520  trap = p1 and p2 should be directories on the same fs.
4522  old_dentry = Parent directory has inode locked exclusive. This is one* and only case when ->lookup() gets called on non in-lookup* dentries - as the matter of fact, this only gets called* when directory is guaranteed to have no in-lookup children* at all.
4523  error = PTR_ERR(old_dentry)
4524  If IS_ERR(old_dentry) Then Go to exit3
4527  error = -ENOENT
4528  If d_is_negative(old_dentry) Then Go to exit4
4530  new_dentry = Parent directory has inode locked exclusive. This is one* and only case when ->lookup() gets called on non in-lookup* dentries - as the matter of fact, this only gets called* when directory is guaranteed to have no in-lookup children* at all.
4531  error = PTR_ERR(new_dentry)
4532  If IS_ERR(new_dentry) Then Go to exit4
4534  error = -EEXIST
4535  If flags & Don't overwrite target && d_is_positive(new_dentry) Then Go to exit5
4537  If flags & Exchange source and dest Then
4538  error = -ENOENT
4539  If d_is_negative(new_dentry) Then Go to exit5
4542  If Not d_is_dir(new_dentry) Then
4543  error = -ENOTDIR
4544  If name[len] Then Go to exit5
4549  If Not d_is_dir(old_dentry) Then
4550  error = -ENOTDIR
4551  If name[len] Then Go to exit5
4553  If Not (flags & Exchange source and dest ) && name[len] Then Go to exit5
4557  error = -EINVAL
4558  If old_dentry == trap Then Go to exit5
4561  If Not (flags & Exchange source and dest ) Then error = -ENOTEMPTY
4563  If new_dentry == trap Then Go to exit5
4566  error = security_path_rename( & old_path, old_dentry, & new_path, new_dentry, flags)
4568  If error Then Go to exit5
4570  error = vfs_rename - rename a filesystem object*@old_dir: parent of source*@old_dentry: source*@new_dir: parent of destination*@new_dentry: destination*@delegated_inode: returns an inode needing a delegation break*@flags: rename flags
4573  exit5 :
4574  dput(new_dentry)
4575  exit4 :
4576  dput(old_dentry)
4577  exit3 :
4578  unlock_rename(dentry, dentry)
4579  If delegated_inode Then
4580  error = break_deleg_wait( & delegated_inode)
4581  If Not error Then Go to retry_deleg
4584  mnt_drop_write(mnt)
4585  exit2 :
4586  If ry_estale - determine whether the caller should retry an operation*@error: the error that would currently be returned*@flags: flags being used for next lookup attempt* Check to see if the error code was -ESTALE, and then determine whether Then should_retry = true
4588  path_put - put a reference to a path*@path: path to put the reference to* Given a path decrement the reference count to the dentry and the vfsmount.
4589  putname(to)
4590  exit1 :
4591  path_put - put a reference to a path*@path: path to put the reference to* Given a path decrement the reference count to the dentry and the vfsmount.
4592  putname(from)
4593  If should_retry Then
4594  should_retry = false
4595  lookup_flags |= ll ->d_revalidate() to trust no cache
4596  Go to retry
4598  exit :
4599  Return error
Caller
NameDescribe
SYSCALL_DEFINE5
SYSCALL_DEFINE4
SYSCALL_DEFINE2