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 */
|
2015-09-08 21:58:40 +00:00
|
|
|
#ifndef _LINUX_DAX_H
|
|
|
|
#define _LINUX_DAX_H
|
|
|
|
|
|
|
|
#include <linux/fs.h>
|
|
|
|
#include <linux/mm.h>
|
2016-05-12 16:29:17 +00:00
|
|
|
#include <linux/radix-tree.h>
|
2015-09-08 21:58:40 +00:00
|
|
|
#include <asm/pgtable.h>
|
|
|
|
|
2016-09-19 01:24:49 +00:00
|
|
|
struct iomap_ops;
|
2017-01-25 02:44:18 +00:00
|
|
|
struct dax_device;
|
|
|
|
struct dax_operations {
|
|
|
|
/*
|
|
|
|
* direct_access: translate a device-relative
|
|
|
|
* logical-page-offset into an absolute physical pfn. Return the
|
|
|
|
* number of pages available for DAX at that pfn.
|
|
|
|
*/
|
|
|
|
long (*direct_access)(struct dax_device *, pgoff_t, long,
|
|
|
|
void **, pfn_t *);
|
2017-06-27 20:06:22 +00:00
|
|
|
/* copy_from_iter: required operation for fs-dax direct-i/o */
|
2017-05-29 19:22:50 +00:00
|
|
|
size_t (*copy_from_iter)(struct dax_device *, pgoff_t, void *, size_t,
|
|
|
|
struct iov_iter *);
|
2018-05-02 13:46:33 +00:00
|
|
|
/* copy_to_iter: required operation for fs-dax direct-i/o */
|
|
|
|
size_t (*copy_to_iter)(struct dax_device *, pgoff_t, void *, size_t,
|
|
|
|
struct iov_iter *);
|
2017-01-25 02:44:18 +00:00
|
|
|
};
|
2016-09-19 01:24:49 +00:00
|
|
|
|
2017-06-27 04:28:41 +00:00
|
|
|
extern struct attribute_group dax_attribute_group;
|
|
|
|
|
2017-05-13 23:31:05 +00:00
|
|
|
#if IS_ENABLED(CONFIG_DAX)
|
|
|
|
struct dax_device *dax_get_by_host(const char *host);
|
2018-03-30 00:22:13 +00:00
|
|
|
struct dax_device *alloc_dax(void *private, const char *host,
|
|
|
|
const struct dax_operations *ops);
|
2017-05-13 23:31:05 +00:00
|
|
|
void put_dax(struct dax_device *dax_dev);
|
2018-03-30 00:22:13 +00:00
|
|
|
void kill_dax(struct dax_device *dax_dev);
|
|
|
|
void dax_write_cache(struct dax_device *dax_dev, bool wc);
|
|
|
|
bool dax_write_cache_enabled(struct dax_device *dax_dev);
|
2017-05-13 23:31:05 +00:00
|
|
|
#else
|
|
|
|
static inline struct dax_device *dax_get_by_host(const char *host)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-03-30 00:22:13 +00:00
|
|
|
static inline struct dax_device *alloc_dax(void *private, const char *host,
|
|
|
|
const struct dax_operations *ops)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Callers should check IS_ENABLED(CONFIG_DAX) to know if this
|
|
|
|
* NULL is an error or expected.
|
|
|
|
*/
|
|
|
|
return NULL;
|
|
|
|
}
|
2017-05-13 23:31:05 +00:00
|
|
|
static inline void put_dax(struct dax_device *dax_dev)
|
|
|
|
{
|
|
|
|
}
|
2018-03-30 00:22:13 +00:00
|
|
|
static inline void kill_dax(struct dax_device *dax_dev)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline void dax_write_cache(struct dax_device *dax_dev, bool wc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static inline bool dax_write_cache_enabled(struct dax_device *dax_dev)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2017-05-13 23:31:05 +00:00
|
|
|
#endif
|
|
|
|
|
2018-03-07 23:26:44 +00:00
|
|
|
struct writeback_control;
|
2017-05-08 17:55:27 +00:00
|
|
|
int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff);
|
|
|
|
#if IS_ENABLED(CONFIG_FS_DAX)
|
2018-05-30 20:03:46 +00:00
|
|
|
bool __bdev_dax_supported(struct block_device *bdev, int blocksize);
|
|
|
|
static inline bool bdev_dax_supported(struct block_device *bdev, int blocksize)
|
2017-05-08 17:55:27 +00:00
|
|
|
{
|
2018-05-30 20:03:45 +00:00
|
|
|
return __bdev_dax_supported(bdev, blocksize);
|
2017-05-08 17:55:27 +00:00
|
|
|
}
|
2017-05-13 23:31:05 +00:00
|
|
|
|
|
|
|
static inline struct dax_device *fs_dax_get_by_host(const char *host)
|
|
|
|
{
|
|
|
|
return dax_get_by_host(host);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void fs_put_dax(struct dax_device *dax_dev)
|
|
|
|
{
|
|
|
|
put_dax(dax_dev);
|
|
|
|
}
|
|
|
|
|
2017-08-30 16:16:38 +00:00
|
|
|
struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev);
|
2018-03-07 23:26:44 +00:00
|
|
|
int dax_writeback_mapping_range(struct address_space *mapping,
|
|
|
|
struct block_device *bdev, struct writeback_control *wbc);
|
mm, fs, dax: handle layout changes to pinned dax mappings
Background:
get_user_pages() in the filesystem pins file backed memory pages for
access by devices performing dma. However, it only pins the memory pages
not the page-to-file offset association. If a file is truncated the
pages are mapped out of the file and dma may continue indefinitely into
a page that is owned by a device driver. This breaks coherency of the
file vs dma, but the assumption is that if userspace wants the
file-space truncated it does not matter what data is inbound from the
device, it is not relevant anymore. The only expectation is that dma can
safely continue while the filesystem reallocates the block(s).
Problem:
This expectation that dma can safely continue while the filesystem
changes the block map is broken by dax. With dax the target dma page
*is* the filesystem block. The model of leaving the page pinned for dma,
but truncating the file block out of the file, means that the filesytem
is free to reallocate a block under active dma to another file and now
the expected data-incoherency situation has turned into active
data-corruption.
Solution:
Defer all filesystem operations (fallocate(), truncate()) on a dax mode
file while any page/block in the file is under active dma. This solution
assumes that dma is transient. Cases where dma operations are known to
not be transient, like RDMA, have been explicitly disabled via
commits like 5f1d43de5416 "IB/core: disable memory registration of
filesystem-dax vmas".
The dax_layout_busy_page() routine is called by filesystems with a lock
held against mm faults (i_mmap_lock) to find pinned / busy dax pages.
The process of looking up a busy page invalidates all mappings
to trigger any subsequent get_user_pages() to block on i_mmap_lock.
The filesystem continues to call dax_layout_busy_page() until it finally
returns no more active pages. This approach assumes that the page
pinning is transient, if that assumption is violated the system would
have likely hung from the uncompleted I/O.
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2018-03-10 01:44:31 +00:00
|
|
|
|
|
|
|
struct page *dax_layout_busy_page(struct address_space *mapping);
|
2017-05-08 17:55:27 +00:00
|
|
|
#else
|
2018-05-30 20:03:46 +00:00
|
|
|
static inline bool bdev_dax_supported(struct block_device *bdev,
|
2018-05-30 20:03:45 +00:00
|
|
|
int blocksize)
|
2017-05-08 17:55:27 +00:00
|
|
|
{
|
2018-05-30 20:03:46 +00:00
|
|
|
return false;
|
2017-05-08 17:55:27 +00:00
|
|
|
}
|
|
|
|
|
2017-05-13 23:31:05 +00:00
|
|
|
static inline struct dax_device *fs_dax_get_by_host(const char *host)
|
2017-05-08 17:55:27 +00:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2017-05-13 23:31:05 +00:00
|
|
|
static inline void fs_put_dax(struct dax_device *dax_dev)
|
2017-05-08 17:55:27 +00:00
|
|
|
{
|
|
|
|
}
|
2017-08-30 16:16:38 +00:00
|
|
|
|
|
|
|
static inline struct dax_device *fs_dax_get_by_bdev(struct block_device *bdev)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-03-07 23:26:44 +00:00
|
|
|
|
mm, fs, dax: handle layout changes to pinned dax mappings
Background:
get_user_pages() in the filesystem pins file backed memory pages for
access by devices performing dma. However, it only pins the memory pages
not the page-to-file offset association. If a file is truncated the
pages are mapped out of the file and dma may continue indefinitely into
a page that is owned by a device driver. This breaks coherency of the
file vs dma, but the assumption is that if userspace wants the
file-space truncated it does not matter what data is inbound from the
device, it is not relevant anymore. The only expectation is that dma can
safely continue while the filesystem reallocates the block(s).
Problem:
This expectation that dma can safely continue while the filesystem
changes the block map is broken by dax. With dax the target dma page
*is* the filesystem block. The model of leaving the page pinned for dma,
but truncating the file block out of the file, means that the filesytem
is free to reallocate a block under active dma to another file and now
the expected data-incoherency situation has turned into active
data-corruption.
Solution:
Defer all filesystem operations (fallocate(), truncate()) on a dax mode
file while any page/block in the file is under active dma. This solution
assumes that dma is transient. Cases where dma operations are known to
not be transient, like RDMA, have been explicitly disabled via
commits like 5f1d43de5416 "IB/core: disable memory registration of
filesystem-dax vmas".
The dax_layout_busy_page() routine is called by filesystems with a lock
held against mm faults (i_mmap_lock) to find pinned / busy dax pages.
The process of looking up a busy page invalidates all mappings
to trigger any subsequent get_user_pages() to block on i_mmap_lock.
The filesystem continues to call dax_layout_busy_page() until it finally
returns no more active pages. This approach assumes that the page
pinning is transient, if that assumption is violated the system would
have likely hung from the uncompleted I/O.
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Reported-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2018-03-10 01:44:31 +00:00
|
|
|
static inline struct page *dax_layout_busy_page(struct address_space *mapping)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-03-07 23:26:44 +00:00
|
|
|
static inline int dax_writeback_mapping_range(struct address_space *mapping,
|
|
|
|
struct block_device *bdev, struct writeback_control *wbc)
|
|
|
|
{
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
}
|
2017-05-08 17:55:27 +00:00
|
|
|
#endif
|
|
|
|
|
2017-04-11 16:49:49 +00:00
|
|
|
int dax_read_lock(void);
|
|
|
|
void dax_read_unlock(int id);
|
2017-01-25 07:02:09 +00:00
|
|
|
bool dax_alive(struct dax_device *dax_dev);
|
|
|
|
void *dax_get_private(struct dax_device *dax_dev);
|
2017-01-27 04:37:35 +00:00
|
|
|
long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
|
|
|
|
void **kaddr, pfn_t *pfn);
|
2017-05-29 19:57:56 +00:00
|
|
|
size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
|
|
|
|
size_t bytes, struct iov_iter *i);
|
2018-05-02 13:46:33 +00:00
|
|
|
size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr,
|
|
|
|
size_t bytes, struct iov_iter *i);
|
2017-09-01 01:47:43 +00:00
|
|
|
void dax_flush(struct dax_device *dax_dev, void *addr, size_t size);
|
2017-04-11 16:49:49 +00:00
|
|
|
|
2016-11-08 00:32:46 +00:00
|
|
|
ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
|
2017-01-28 07:20:26 +00:00
|
|
|
const struct iomap_ops *ops);
|
2018-06-28 06:26:17 +00:00
|
|
|
vm_fault_t dax_iomap_fault(struct vm_fault *vmf, enum page_entry_size pe_size,
|
2018-01-07 21:38:43 +00:00
|
|
|
pfn_t *pfnp, int *errp, const struct iomap_ops *ops);
|
2018-06-08 00:04:29 +00:00
|
|
|
vm_fault_t dax_finish_sync_fault(struct vm_fault *vmf,
|
|
|
|
enum page_entry_size pe_size, pfn_t pfn);
|
2016-05-12 16:29:18 +00:00
|
|
|
int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
|
2016-08-10 15:22:44 +00:00
|
|
|
int dax_invalidate_mapping_entry_sync(struct address_space *mapping,
|
|
|
|
pgoff_t index);
|
2016-01-29 04:25:31 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_FS_DAX
|
2017-01-27 21:31:42 +00:00
|
|
|
int __dax_zero_page_range(struct block_device *bdev,
|
|
|
|
struct dax_device *dax_dev, sector_t sector,
|
2016-05-09 08:47:04 +00:00
|
|
|
unsigned int offset, unsigned int length);
|
2016-01-29 04:25:31 +00:00
|
|
|
#else
|
2016-05-09 08:47:04 +00:00
|
|
|
static inline int __dax_zero_page_range(struct block_device *bdev,
|
2017-01-27 21:31:42 +00:00
|
|
|
struct dax_device *dax_dev, sector_t sector,
|
|
|
|
unsigned int offset, unsigned int length)
|
2016-05-09 08:47:04 +00:00
|
|
|
{
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
2016-01-29 04:25:31 +00:00
|
|
|
#endif
|
|
|
|
|
2016-01-22 23:10:40 +00:00
|
|
|
static inline bool dax_mapping(struct address_space *mapping)
|
|
|
|
{
|
|
|
|
return mapping->host && IS_DAX(mapping->host);
|
|
|
|
}
|
2016-02-26 23:19:55 +00:00
|
|
|
|
2015-09-08 21:58:40 +00:00
|
|
|
#endif
|