License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 14:07:57 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Directory operations for Coda filesystem
|
|
|
|
* Original version: (C) 1996 P. Braam and M. Callahan
|
|
|
|
* Rewritten for Linux 2.1. (C) 1997 Carnegie Mellon University
|
|
|
|
*
|
|
|
|
* Carnegie Mellon encourages users to contribute improvements to
|
|
|
|
* the Coda project. Contact Peter Braam (coda@cs.cmu.edu).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/time.h>
|
|
|
|
#include <linux/fs.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/file.h>
|
|
|
|
#include <linux/stat.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/string.h>
|
2010-10-25 06:03:44 +00:00
|
|
|
#include <linux/spinlock.h>
|
2011-01-07 06:49:57 +00:00
|
|
|
#include <linux/namei.h>
|
2014-08-08 21:20:33 +00:00
|
|
|
#include <linux/uaccess.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include <linux/coda.h>
|
2019-07-16 23:28:47 +00:00
|
|
|
#include "coda_psdev.h"
|
2011-01-12 21:36:09 +00:00
|
|
|
#include "coda_linux.h"
|
|
|
|
#include "coda_cache.h"
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-03-24 11:15:53 +00:00
|
|
|
#include "coda_int.h"
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* same as fs/bad_inode.c */
|
|
|
|
static int coda_return_EIO(void)
|
|
|
|
{
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
#define CODA_EIO_ERROR ((void *) (coda_return_EIO))
|
|
|
|
|
|
|
|
/* inode operations for directories */
|
|
|
|
/* access routines: lookup, readlink, permission */
|
2012-06-10 21:13:09 +00:00
|
|
|
static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsigned int flags)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2012-01-10 16:11:49 +00:00
|
|
|
struct super_block *sb = dir->i_sb;
|
2005-04-16 22:20:36 +00:00
|
|
|
const char *name = entry->d_name.name;
|
|
|
|
size_t length = entry->d_name.len;
|
2012-01-10 16:11:49 +00:00
|
|
|
struct inode *inode;
|
|
|
|
int type = 0;
|
2007-07-19 08:48:49 +00:00
|
|
|
|
|
|
|
if (length > CODA_MAXNAMLEN) {
|
2019-07-16 23:28:23 +00:00
|
|
|
pr_err("name too long: lookup, %s %zu\n",
|
|
|
|
coda_i2s(dir), length);
|
2005-04-16 22:20:36 +00:00
|
|
|
return ERR_PTR(-ENAMETOOLONG);
|
|
|
|
}
|
|
|
|
|
2007-07-19 08:48:49 +00:00
|
|
|
/* control object, create inode on the fly */
|
2014-10-21 19:20:42 +00:00
|
|
|
if (is_root_inode(dir) && coda_iscontrol(name, length)) {
|
2012-01-10 16:11:49 +00:00
|
|
|
inode = coda_cnode_makectl(sb);
|
2007-07-19 08:48:49 +00:00
|
|
|
type = CODA_NOCACHE;
|
2012-01-10 16:11:49 +00:00
|
|
|
} else {
|
|
|
|
struct CodaFid fid = { { 0, } };
|
|
|
|
int error = venus_lookup(sb, coda_i2f(dir), name, length,
|
|
|
|
&type, &fid);
|
|
|
|
inode = !error ? coda_cnode_make(&fid, sb) : ERR_PTR(error);
|
2007-07-19 08:48:49 +00:00
|
|
|
}
|
|
|
|
|
2012-01-10 16:11:49 +00:00
|
|
|
if (!IS_ERR(inode) && (type & CODA_NOCACHE))
|
2007-07-19 08:48:49 +00:00
|
|
|
coda_flag_inode(inode, C_VATTR | C_PURGE);
|
|
|
|
|
2012-01-10 16:11:49 +00:00
|
|
|
if (inode == ERR_PTR(-ENOENT))
|
|
|
|
inode = NULL;
|
|
|
|
|
2007-07-19 08:48:49 +00:00
|
|
|
return d_splice_alias(inode, entry);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-21 13:19:43 +00:00
|
|
|
int coda_permission(struct user_namespace *mnt_userns, struct inode *inode,
|
|
|
|
int mask)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-10-25 06:03:45 +00:00
|
|
|
int error;
|
2008-07-16 01:03:57 +00:00
|
|
|
|
2011-06-20 23:28:19 +00:00
|
|
|
if (mask & MAY_NOT_BLOCK)
|
2011-01-07 06:49:58 +00:00
|
|
|
return -ECHILD;
|
|
|
|
|
2008-07-16 01:03:57 +00:00
|
|
|
mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!mask)
|
2010-10-25 06:03:45 +00:00
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-07-31 11:41:58 +00:00
|
|
|
if ((mask & MAY_EXEC) && !execute_ok(inode))
|
|
|
|
return -EACCES;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
if (coda_cache_check(inode, mask))
|
2010-10-25 06:03:45 +00:00
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-10-25 06:03:45 +00:00
|
|
|
error = venus_access(inode->i_sb, coda_i2f(inode), mask);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (!error)
|
|
|
|
coda_cache_enter(inode, mask);
|
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
static inline void coda_dir_update_mtime(struct inode *dir)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
#ifdef REQUERY_VENUS_FOR_MTIME
|
|
|
|
/* invalidate the directory cnode's attributes so we refetch the
|
|
|
|
* attributes from venus next time the inode is referenced */
|
|
|
|
coda_flag_inode(dir, C_VATTR);
|
|
|
|
#else
|
|
|
|
/* optimistically we can also act as if our nose bleeds. The
|
2007-07-19 08:48:43 +00:00
|
|
|
* granularity of the mtime is coarse anyways so we might actually be
|
|
|
|
* right most of the time. Note: we only do this for directories. */
|
2016-09-14 14:48:05 +00:00
|
|
|
dir->i_mtime = dir->i_ctime = current_time(dir);
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
2007-07-19 08:48:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* we have to wrap inc_nlink/drop_nlink because sometimes userspace uses a
|
|
|
|
* trick to fool GNU find's optimizations. If we can't be sure of the link
|
|
|
|
* (because of volume mount points) we set i_nlink to 1 which forces find
|
|
|
|
* to consider every child as a possible directory. We should also never
|
|
|
|
* see an increment or decrement for deleted directories where i_nlink == 0 */
|
|
|
|
static inline void coda_dir_inc_nlink(struct inode *dir)
|
|
|
|
{
|
|
|
|
if (dir->i_nlink >= 2)
|
|
|
|
inc_nlink(dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void coda_dir_drop_nlink(struct inode *dir)
|
|
|
|
{
|
|
|
|
if (dir->i_nlink > 2)
|
|
|
|
drop_nlink(dir);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* creation routines: create, mknod, mkdir, link, symlink */
|
2021-01-21 13:19:43 +00:00
|
|
|
static int coda_create(struct user_namespace *mnt_userns, struct inode *dir,
|
|
|
|
struct dentry *de, umode_t mode, bool excl)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2010-10-25 06:03:45 +00:00
|
|
|
int error;
|
2005-04-16 22:20:36 +00:00
|
|
|
const char *name=de->d_name.name;
|
|
|
|
int length=de->d_name.len;
|
|
|
|
struct inode *inode;
|
|
|
|
struct CodaFid newfid;
|
|
|
|
struct coda_vattr attrs;
|
|
|
|
|
2014-10-21 19:20:42 +00:00
|
|
|
if (is_root_inode(dir) && coda_iscontrol(name, length))
|
2005-04-16 22:20:36 +00:00
|
|
|
return -EPERM;
|
|
|
|
|
|
|
|
error = venus_create(dir->i_sb, coda_i2f(dir), name, length,
|
|
|
|
0, mode, &newfid, &attrs);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (error)
|
|
|
|
goto err_out;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
inode = coda_iget(dir->i_sb, &newfid, &attrs);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (IS_ERR(inode)) {
|
|
|
|
error = PTR_ERR(inode);
|
|
|
|
goto err_out;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* invalidate the directory cnode's attributes */
|
2007-07-19 08:48:43 +00:00
|
|
|
coda_dir_update_mtime(dir);
|
2005-04-16 22:20:36 +00:00
|
|
|
d_instantiate(de, inode);
|
2007-07-19 08:48:43 +00:00
|
|
|
return 0;
|
2010-10-25 06:03:45 +00:00
|
|
|
err_out:
|
|
|
|
d_drop(de);
|
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2021-01-21 13:19:43 +00:00
|
|
|
static int coda_mkdir(struct user_namespace *mnt_userns, struct inode *dir,
|
|
|
|
struct dentry *de, umode_t mode)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
struct inode *inode;
|
|
|
|
struct coda_vattr attrs;
|
|
|
|
const char *name = de->d_name.name;
|
|
|
|
int len = de->d_name.len;
|
|
|
|
int error;
|
|
|
|
struct CodaFid newfid;
|
|
|
|
|
2014-10-21 19:20:42 +00:00
|
|
|
if (is_root_inode(dir) && coda_iscontrol(name, len))
|
2005-04-16 22:20:36 +00:00
|
|
|
return -EPERM;
|
|
|
|
|
|
|
|
attrs.va_mode = mode;
|
|
|
|
error = venus_mkdir(dir->i_sb, coda_i2f(dir),
|
|
|
|
name, len, &newfid, &attrs);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (error)
|
|
|
|
goto err_out;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
inode = coda_iget(dir->i_sb, &newfid, &attrs);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (IS_ERR(inode)) {
|
|
|
|
error = PTR_ERR(inode);
|
|
|
|
goto err_out;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2007-07-19 08:48:43 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* invalidate the directory cnode's attributes */
|
2007-07-19 08:48:43 +00:00
|
|
|
coda_dir_inc_nlink(dir);
|
|
|
|
coda_dir_update_mtime(dir);
|
2005-04-16 22:20:36 +00:00
|
|
|
d_instantiate(de, inode);
|
2007-07-19 08:48:43 +00:00
|
|
|
return 0;
|
2010-10-25 06:03:45 +00:00
|
|
|
err_out:
|
|
|
|
d_drop(de);
|
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* try to make de an entry in dir_inodde linked to source_de */
|
|
|
|
static int coda_link(struct dentry *source_de, struct inode *dir_inode,
|
|
|
|
struct dentry *de)
|
|
|
|
{
|
2015-03-17 22:25:59 +00:00
|
|
|
struct inode *inode = d_inode(source_de);
|
2005-04-16 22:20:36 +00:00
|
|
|
const char * name = de->d_name.name;
|
|
|
|
int len = de->d_name.len;
|
|
|
|
int error;
|
|
|
|
|
2014-10-21 19:20:42 +00:00
|
|
|
if (is_root_inode(dir_inode) && coda_iscontrol(name, len))
|
2005-04-16 22:20:36 +00:00
|
|
|
return -EPERM;
|
|
|
|
|
|
|
|
error = venus_link(dir_inode->i_sb, coda_i2f(inode),
|
|
|
|
coda_i2f(dir_inode), (const char *)name, len);
|
2007-07-19 08:48:43 +00:00
|
|
|
if (error) {
|
2005-04-16 22:20:36 +00:00
|
|
|
d_drop(de);
|
2010-10-25 06:03:45 +00:00
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
coda_dir_update_mtime(dir_inode);
|
2010-10-23 15:11:40 +00:00
|
|
|
ihold(inode);
|
2005-04-16 22:20:36 +00:00
|
|
|
d_instantiate(de, inode);
|
2006-10-01 06:29:04 +00:00
|
|
|
inc_nlink(inode);
|
2010-10-25 06:03:45 +00:00
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-21 13:19:43 +00:00
|
|
|
static int coda_symlink(struct user_namespace *mnt_userns,
|
|
|
|
struct inode *dir_inode, struct dentry *de,
|
2005-04-16 22:20:36 +00:00
|
|
|
const char *symname)
|
|
|
|
{
|
2010-10-25 06:03:45 +00:00
|
|
|
const char *name = de->d_name.name;
|
2005-04-16 22:20:36 +00:00
|
|
|
int len = de->d_name.len;
|
|
|
|
int symlen;
|
2010-10-25 06:03:45 +00:00
|
|
|
int error;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2014-10-21 19:20:42 +00:00
|
|
|
if (is_root_inode(dir_inode) && coda_iscontrol(name, len))
|
2005-04-16 22:20:36 +00:00
|
|
|
return -EPERM;
|
|
|
|
|
|
|
|
symlen = strlen(symname);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (symlen > CODA_MAXPATHLEN)
|
2005-04-16 22:20:36 +00:00
|
|
|
return -ENAMETOOLONG;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This entry is now negative. Since we do not create
|
2007-07-19 08:48:43 +00:00
|
|
|
* an inode for the entry we have to drop it.
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
d_drop(de);
|
2007-07-19 08:48:43 +00:00
|
|
|
error = venus_symlink(dir_inode->i_sb, coda_i2f(dir_inode), name, len,
|
2005-04-16 22:20:36 +00:00
|
|
|
symname, symlen);
|
|
|
|
|
|
|
|
/* mtime is no good anymore */
|
2010-10-25 06:03:45 +00:00
|
|
|
if (!error)
|
2007-07-19 08:48:43 +00:00
|
|
|
coda_dir_update_mtime(dir_inode);
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* destruction routines: unlink, rmdir */
|
2008-04-29 07:58:44 +00:00
|
|
|
static int coda_unlink(struct inode *dir, struct dentry *de)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int error;
|
|
|
|
const char *name = de->d_name.name;
|
|
|
|
int len = de->d_name.len;
|
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
error = venus_remove(dir->i_sb, coda_i2f(dir), name, len);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (error)
|
2007-07-19 08:48:43 +00:00
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
coda_dir_update_mtime(dir);
|
2015-03-17 22:25:59 +00:00
|
|
|
drop_nlink(d_inode(de));
|
2007-07-19 08:48:43 +00:00
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2008-04-29 07:58:44 +00:00
|
|
|
static int coda_rmdir(struct inode *dir, struct dentry *de)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
const char *name = de->d_name.name;
|
|
|
|
int len = de->d_name.len;
|
2007-07-19 08:48:43 +00:00
|
|
|
int error;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
|
2007-07-19 08:48:43 +00:00
|
|
|
if (!error) {
|
|
|
|
/* VFS may delete the child */
|
2015-03-17 22:25:59 +00:00
|
|
|
if (d_really_is_positive(de))
|
|
|
|
clear_nlink(d_inode(de));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
/* fix the link count of the parent */
|
|
|
|
coda_dir_drop_nlink(dir);
|
|
|
|
coda_dir_update_mtime(dir);
|
2007-07-19 08:48:43 +00:00
|
|
|
}
|
2007-07-19 08:48:43 +00:00
|
|
|
return error;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* rename */
|
2021-01-21 13:19:43 +00:00
|
|
|
static int coda_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
|
|
|
|
struct dentry *old_dentry, struct inode *new_dir,
|
|
|
|
struct dentry *new_dentry, unsigned int flags)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-07-19 08:48:43 +00:00
|
|
|
const char *old_name = old_dentry->d_name.name;
|
|
|
|
const char *new_name = new_dentry->d_name.name;
|
2005-04-16 22:20:36 +00:00
|
|
|
int old_length = old_dentry->d_name.len;
|
|
|
|
int new_length = new_dentry->d_name.len;
|
2007-07-19 08:48:43 +00:00
|
|
|
int error;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
fs: make remaining filesystems use .rename2
This is trivial to do:
- add flags argument to foo_rename()
- check if flags is zero
- assign foo_rename() to .rename2 instead of .rename
This doesn't mean it's impossible to support RENAME_NOREPLACE for these
filesystems, but it is not trivial, like for local filesystems.
RENAME_NOREPLACE must guarantee atomicity (i.e. it shouldn't be possible
for a file to be created on one host while it is overwritten by rename on
another host).
Filesystems converted:
9p, afs, ceph, coda, ecryptfs, kernfs, lustre, ncpfs, nfs, ocfs2, orangefs.
After this, we can get rid of the duplicate interfaces for rename.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: David Howells <dhowells@redhat.com> [AFS]
Acked-by: Mike Marshall <hubcap@omnibond.com>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Jan Harkes <jaharkes@cs.cmu.edu>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Mark Fasheh <mfasheh@suse.com>
2016-09-27 09:03:58 +00:00
|
|
|
if (flags)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2007-07-19 08:48:43 +00:00
|
|
|
error = venus_rename(old_dir->i_sb, coda_i2f(old_dir),
|
|
|
|
coda_i2f(new_dir), old_length, new_length,
|
2005-04-16 22:20:36 +00:00
|
|
|
(const char *) old_name, (const char *)new_name);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (!error) {
|
2015-03-17 22:25:59 +00:00
|
|
|
if (d_really_is_positive(new_dentry)) {
|
VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry)
Convert the following where appropriate:
(1) S_ISLNK(dentry->d_inode) to d_is_symlink(dentry).
(2) S_ISREG(dentry->d_inode) to d_is_reg(dentry).
(3) S_ISDIR(dentry->d_inode) to d_is_dir(dentry). This is actually more
complicated than it appears as some calls should be converted to
d_can_lookup() instead. The difference is whether the directory in
question is a real dir with a ->lookup op or whether it's a fake dir with
a ->d_automount op.
In some circumstances, we can subsume checks for dentry->d_inode not being
NULL into this, provided we the code isn't in a filesystem that expects
d_inode to be NULL if the dirent really *is* negative (ie. if we're going to
use d_inode() rather than d_backing_inode() to get the inode pointer).
Note that the dentry type field may be set to something other than
DCACHE_MISS_TYPE when d_inode is NULL in the case of unionmount, where the VFS
manages the fall-through from a negative dentry to a lower layer. In such a
case, the dentry type of the negative union dentry is set to the same as the
type of the lower dentry.
However, if you know d_inode is not NULL at the call site, then you can use
the d_is_xxx() functions even in a filesystem.
There is one further complication: a 0,0 chardev dentry may be labelled
DCACHE_WHITEOUT_TYPE rather than DCACHE_SPECIAL_TYPE. Strictly, this was
intended for special directory entry types that don't have attached inodes.
The following perl+coccinelle script was used:
use strict;
my @callers;
open($fd, 'git grep -l \'S_IS[A-Z].*->d_inode\' |') ||
die "Can't grep for S_ISDIR and co. callers";
@callers = <$fd>;
close($fd);
unless (@callers) {
print "No matches\n";
exit(0);
}
my @cocci = (
'@@',
'expression E;',
'@@',
'',
'- S_ISLNK(E->d_inode->i_mode)',
'+ d_is_symlink(E)',
'',
'@@',
'expression E;',
'@@',
'',
'- S_ISDIR(E->d_inode->i_mode)',
'+ d_is_dir(E)',
'',
'@@',
'expression E;',
'@@',
'',
'- S_ISREG(E->d_inode->i_mode)',
'+ d_is_reg(E)' );
my $coccifile = "tmp.sp.cocci";
open($fd, ">$coccifile") || die $coccifile;
print($fd "$_\n") || die $coccifile foreach (@cocci);
close($fd);
foreach my $file (@callers) {
chomp $file;
print "Processing ", $file, "\n";
system("spatch", "--sp-file", $coccifile, $file, "--in-place", "--no-show-diff") == 0 ||
die "spatch failed";
}
[AV: overlayfs parts skipped]
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2015-01-29 12:02:35 +00:00
|
|
|
if (d_is_dir(new_dentry)) {
|
2007-07-19 08:48:43 +00:00
|
|
|
coda_dir_drop_nlink(old_dir);
|
|
|
|
coda_dir_inc_nlink(new_dir);
|
|
|
|
}
|
|
|
|
coda_dir_update_mtime(old_dir);
|
|
|
|
coda_dir_update_mtime(new_dir);
|
2015-03-17 22:25:59 +00:00
|
|
|
coda_flag_inode(d_inode(new_dentry), C_VATTR);
|
2005-04-16 22:20:36 +00:00
|
|
|
} else {
|
|
|
|
coda_flag_inode(old_dir, C_VATTR);
|
|
|
|
coda_flag_inode(new_dir, C_VATTR);
|
2007-07-19 08:48:43 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned int CDT2DT(unsigned char cdt)
|
|
|
|
{
|
|
|
|
unsigned int dt;
|
|
|
|
|
|
|
|
switch(cdt) {
|
|
|
|
case CDT_UNKNOWN: dt = DT_UNKNOWN; break;
|
|
|
|
case CDT_FIFO: dt = DT_FIFO; break;
|
|
|
|
case CDT_CHR: dt = DT_CHR; break;
|
|
|
|
case CDT_DIR: dt = DT_DIR; break;
|
|
|
|
case CDT_BLK: dt = DT_BLK; break;
|
|
|
|
case CDT_REG: dt = DT_REG; break;
|
|
|
|
case CDT_LNK: dt = DT_LNK; break;
|
|
|
|
case CDT_SOCK: dt = DT_SOCK; break;
|
|
|
|
case CDT_WHT: dt = DT_WHT; break;
|
|
|
|
default: dt = DT_UNKNOWN; break;
|
|
|
|
}
|
|
|
|
return dt;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* support routines */
|
2013-05-23 01:15:30 +00:00
|
|
|
static int coda_venus_readdir(struct file *coda_file, struct dir_context *ctx)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2007-07-19 08:48:47 +00:00
|
|
|
struct coda_file_info *cfi;
|
|
|
|
struct coda_inode_info *cii;
|
|
|
|
struct file *host_file;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct venus_dirent *vdir;
|
2011-07-16 21:06:30 +00:00
|
|
|
unsigned long vdir_size = offsetof(struct venus_dirent, d_name);
|
2005-04-16 22:20:36 +00:00
|
|
|
unsigned int type;
|
|
|
|
struct qstr name;
|
|
|
|
ino_t ino;
|
2007-07-19 08:48:47 +00:00
|
|
|
int ret;
|
|
|
|
|
2019-07-16 23:29:09 +00:00
|
|
|
cfi = coda_ftoc(coda_file);
|
2007-07-19 08:48:47 +00:00
|
|
|
host_file = cfi->cfi_container;
|
|
|
|
|
2014-12-11 18:19:03 +00:00
|
|
|
cii = ITOC(file_inode(coda_file));
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-09-27 08:49:39 +00:00
|
|
|
vdir = kmalloc(sizeof(*vdir), GFP_KERNEL);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!vdir) return -ENOMEM;
|
|
|
|
|
2013-05-23 01:15:30 +00:00
|
|
|
if (!dir_emit_dots(coda_file, ctx))
|
|
|
|
goto out;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
while (1) {
|
2017-09-01 15:39:13 +00:00
|
|
|
loff_t pos = ctx->pos - 2;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* read entries from the directory file */
|
2017-09-01 15:39:13 +00:00
|
|
|
ret = kernel_read(host_file, vdir, sizeof(*vdir), &pos);
|
2005-04-16 22:20:36 +00:00
|
|
|
if (ret < 0) {
|
2014-06-06 21:36:20 +00:00
|
|
|
pr_err("%s: read dir %s failed %d\n",
|
|
|
|
__func__, coda_f2s(&cii->c_fid), ret);
|
2005-04-16 22:20:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (ret == 0) break; /* end of directory file reached */
|
|
|
|
|
|
|
|
/* catch truncated reads */
|
|
|
|
if (ret < vdir_size || ret < vdir_size + vdir->d_namlen) {
|
2014-06-06 21:36:20 +00:00
|
|
|
pr_err("%s: short read on %s\n",
|
|
|
|
__func__, coda_f2s(&cii->c_fid));
|
2005-04-16 22:20:36 +00:00
|
|
|
ret = -EBADF;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* validate whether the directory file actually makes sense */
|
|
|
|
if (vdir->d_reclen < vdir_size + vdir->d_namlen) {
|
2014-06-06 21:36:20 +00:00
|
|
|
pr_err("%s: invalid dir %s\n",
|
|
|
|
__func__, coda_f2s(&cii->c_fid));
|
2005-04-16 22:20:36 +00:00
|
|
|
ret = -EBADF;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
name.len = vdir->d_namlen;
|
|
|
|
name.name = vdir->d_name;
|
|
|
|
|
|
|
|
/* Make sure we skip '.' and '..', we already got those */
|
|
|
|
if (name.name[0] == '.' && (name.len == 1 ||
|
2013-05-23 01:15:30 +00:00
|
|
|
(name.name[1] == '.' && name.len == 2)))
|
2005-04-16 22:20:36 +00:00
|
|
|
vdir->d_fileno = name.len = 0;
|
|
|
|
|
|
|
|
/* skip null entries */
|
|
|
|
if (vdir->d_fileno && name.len) {
|
2013-06-19 09:21:03 +00:00
|
|
|
ino = vdir->d_fileno;
|
2005-04-16 22:20:36 +00:00
|
|
|
type = CDT2DT(vdir->d_type);
|
2013-05-23 01:15:30 +00:00
|
|
|
if (!dir_emit(ctx, name.name, name.len, ino, type))
|
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
/* we'll always have progress because d_reclen is unsigned and
|
|
|
|
* we've already established it is non-zero. */
|
2013-05-23 01:15:30 +00:00
|
|
|
ctx->pos += vdir->d_reclen;
|
2007-07-19 08:48:47 +00:00
|
|
|
}
|
2007-07-19 23:23:31 +00:00
|
|
|
out:
|
2005-04-16 22:20:36 +00:00
|
|
|
kfree(vdir);
|
2013-05-23 01:15:30 +00:00
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2015-02-17 21:45:25 +00:00
|
|
|
/* file operations for directories */
|
|
|
|
static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
|
|
|
|
{
|
|
|
|
struct coda_file_info *cfi;
|
|
|
|
struct file *host_file;
|
|
|
|
int ret;
|
|
|
|
|
2019-07-16 23:29:09 +00:00
|
|
|
cfi = coda_ftoc(coda_file);
|
2015-02-17 21:45:25 +00:00
|
|
|
host_file = cfi->cfi_container;
|
|
|
|
|
2016-04-21 03:08:32 +00:00
|
|
|
if (host_file->f_op->iterate || host_file->f_op->iterate_shared) {
|
2015-02-17 21:45:25 +00:00
|
|
|
struct inode *host_inode = file_inode(host_file);
|
|
|
|
ret = -ENOENT;
|
|
|
|
if (!IS_DEADDIR(host_inode)) {
|
2016-04-21 03:08:32 +00:00
|
|
|
if (host_file->f_op->iterate_shared) {
|
|
|
|
inode_lock_shared(host_inode);
|
|
|
|
ret = host_file->f_op->iterate_shared(host_file, ctx);
|
|
|
|
file_accessed(host_file);
|
|
|
|
inode_unlock_shared(host_inode);
|
|
|
|
} else {
|
|
|
|
inode_lock(host_inode);
|
|
|
|
ret = host_file->f_op->iterate(host_file, ctx);
|
|
|
|
file_accessed(host_file);
|
|
|
|
inode_unlock(host_inode);
|
|
|
|
}
|
2015-02-17 21:45:25 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
/* Venus: we must read Venus dirents from a file */
|
|
|
|
return coda_venus_readdir(coda_file, ctx);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* called when a cache lookup succeeds */
|
2012-06-10 20:03:43 +00:00
|
|
|
static int coda_dentry_revalidate(struct dentry *de, unsigned int flags)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
2011-01-07 06:49:57 +00:00
|
|
|
struct inode *inode;
|
2005-04-16 22:20:36 +00:00
|
|
|
struct coda_inode_info *cii;
|
|
|
|
|
2012-06-10 20:03:43 +00:00
|
|
|
if (flags & LOOKUP_RCU)
|
2011-01-07 06:49:57 +00:00
|
|
|
return -ECHILD;
|
|
|
|
|
2015-03-17 22:25:59 +00:00
|
|
|
inode = d_inode(de);
|
2014-10-21 19:20:42 +00:00
|
|
|
if (!inode || is_root_inode(inode))
|
2005-04-16 22:20:36 +00:00
|
|
|
goto out;
|
|
|
|
if (is_bad_inode(inode))
|
|
|
|
goto bad;
|
|
|
|
|
2015-03-17 22:25:59 +00:00
|
|
|
cii = ITOC(d_inode(de));
|
2005-04-16 22:20:36 +00:00
|
|
|
if (!(cii->c_flags & (C_PURGE | C_FLUSH)))
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
shrink_dcache_parent(de);
|
|
|
|
|
|
|
|
/* propagate for a flush */
|
|
|
|
if (cii->c_flags & C_FLUSH)
|
|
|
|
coda_flag_inode_children(inode, C_FLUSH);
|
|
|
|
|
2013-07-05 14:59:33 +00:00
|
|
|
if (d_count(de) > 1)
|
2005-04-16 22:20:36 +00:00
|
|
|
/* pretend it's valid, but don't change the flags */
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
/* clear the flags. */
|
2010-10-25 06:03:44 +00:00
|
|
|
spin_lock(&cii->c_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
|
2010-10-25 06:03:44 +00:00
|
|
|
spin_unlock(&cii->c_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
bad:
|
|
|
|
return 0;
|
|
|
|
out:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the callback from dput() when d_count is going to 0.
|
|
|
|
* We use this to unhash dentries with bad inodes.
|
|
|
|
*/
|
2011-01-07 06:49:23 +00:00
|
|
|
static int coda_dentry_delete(const struct dentry * dentry)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
int flags;
|
|
|
|
|
2015-03-17 22:25:59 +00:00
|
|
|
if (d_really_is_negative(dentry))
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0;
|
|
|
|
|
2015-03-17 22:25:59 +00:00
|
|
|
flags = (ITOC(d_inode(dentry))->c_flags) & C_PURGE;
|
|
|
|
if (is_bad_inode(d_inode(dentry)) || flags) {
|
2005-04-16 22:20:36 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is called when we want to check if the inode has
|
|
|
|
* changed on the server. Coda makes this easy since the
|
|
|
|
* cache manager Venus issues a downcall to the kernel when this
|
|
|
|
* happens
|
|
|
|
*/
|
2013-10-04 22:17:02 +00:00
|
|
|
int coda_revalidate_inode(struct inode *inode)
|
2005-04-16 22:20:36 +00:00
|
|
|
{
|
|
|
|
struct coda_vattr attr;
|
2010-10-25 06:03:45 +00:00
|
|
|
int error;
|
2005-04-16 22:20:36 +00:00
|
|
|
int old_mode;
|
|
|
|
ino_t old_ino;
|
|
|
|
struct coda_inode_info *cii = ITOC(inode);
|
|
|
|
|
2010-10-25 06:03:45 +00:00
|
|
|
if (!cii->c_flags)
|
|
|
|
return 0;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
if (cii->c_flags & (C_VATTR | C_PURGE | C_FLUSH)) {
|
|
|
|
error = venus_getattr(inode->i_sb, &(cii->c_fid), &attr);
|
2010-10-25 06:03:45 +00:00
|
|
|
if (error)
|
|
|
|
return -EIO;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* this inode may be lost if:
|
|
|
|
- it's ino changed
|
|
|
|
- type changes must be permitted for repair and
|
|
|
|
missing mount points.
|
|
|
|
*/
|
|
|
|
old_mode = inode->i_mode;
|
|
|
|
old_ino = inode->i_ino;
|
|
|
|
coda_vattr_to_iattr(inode, &attr);
|
|
|
|
|
|
|
|
if ((old_mode & S_IFMT) != (inode->i_mode & S_IFMT)) {
|
2014-06-06 21:36:19 +00:00
|
|
|
pr_warn("inode %ld, fid %s changed type!\n",
|
2014-06-06 21:36:18 +00:00
|
|
|
inode->i_ino, coda_f2s(&(cii->c_fid)));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* the following can happen when a local fid is replaced
|
|
|
|
with a global one, here we lose and declare the inode bad */
|
|
|
|
if (inode->i_ino != old_ino)
|
2010-10-25 06:03:45 +00:00
|
|
|
return -EIO;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
coda_flag_inode_children(inode, C_FLUSH);
|
2010-10-25 06:03:44 +00:00
|
|
|
|
|
|
|
spin_lock(&cii->c_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
|
2010-10-25 06:03:44 +00:00
|
|
|
spin_unlock(&cii->c_lock);
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2015-02-17 21:45:25 +00:00
|
|
|
|
|
|
|
const struct dentry_operations coda_dentry_operations = {
|
|
|
|
.d_revalidate = coda_dentry_revalidate,
|
|
|
|
.d_delete = coda_dentry_delete,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct inode_operations coda_dir_inode_operations = {
|
|
|
|
.create = coda_create,
|
|
|
|
.lookup = coda_lookup,
|
|
|
|
.link = coda_link,
|
|
|
|
.unlink = coda_unlink,
|
|
|
|
.symlink = coda_symlink,
|
|
|
|
.mkdir = coda_mkdir,
|
|
|
|
.rmdir = coda_rmdir,
|
|
|
|
.mknod = CODA_EIO_ERROR,
|
|
|
|
.rename = coda_rename,
|
|
|
|
.permission = coda_permission,
|
|
|
|
.getattr = coda_getattr,
|
|
|
|
.setattr = coda_setattr,
|
|
|
|
};
|
|
|
|
|
|
|
|
const struct file_operations coda_dir_operations = {
|
|
|
|
.llseek = generic_file_llseek,
|
|
|
|
.read = generic_read_dir,
|
|
|
|
.iterate = coda_readdir,
|
|
|
|
.open = coda_open,
|
|
|
|
.release = coda_release,
|
|
|
|
.fsync = coda_fsync,
|
|
|
|
};
|