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 */
|
2017-03-09 08:59:58 +00:00
|
|
|
#ifndef _RAID5_LOG_H
|
|
|
|
#define _RAID5_LOG_H
|
|
|
|
|
|
|
|
extern int r5l_init_log(struct r5conf *conf, struct md_rdev *rdev);
|
|
|
|
extern void r5l_exit_log(struct r5conf *conf);
|
|
|
|
extern int r5l_write_stripe(struct r5l_log *log, struct stripe_head *head_sh);
|
|
|
|
extern void r5l_write_stripe_run(struct r5l_log *log);
|
|
|
|
extern void r5l_flush_stripe_to_raid(struct r5l_log *log);
|
|
|
|
extern void r5l_stripe_write_finished(struct stripe_head *sh);
|
|
|
|
extern int r5l_handle_flush_request(struct r5l_log *log, struct bio *bio);
|
2017-10-19 01:49:15 +00:00
|
|
|
extern void r5l_quiesce(struct r5l_log *log, int quiesce);
|
2017-03-09 08:59:58 +00:00
|
|
|
extern bool r5l_log_disk_error(struct r5conf *conf);
|
|
|
|
extern bool r5c_is_writeback(struct r5l_log *log);
|
|
|
|
extern int
|
|
|
|
r5c_try_caching_write(struct r5conf *conf, struct stripe_head *sh,
|
|
|
|
struct stripe_head_state *s, int disks);
|
|
|
|
extern void
|
|
|
|
r5c_finish_stripe_write_out(struct r5conf *conf, struct stripe_head *sh,
|
|
|
|
struct stripe_head_state *s);
|
|
|
|
extern void r5c_release_extra_page(struct stripe_head *sh);
|
|
|
|
extern void r5c_use_extra_page(struct stripe_head *sh);
|
|
|
|
extern void r5l_wake_reclaim(struct r5l_log *log, sector_t space);
|
|
|
|
extern void r5c_handle_cached_data_endio(struct r5conf *conf,
|
2017-03-15 03:05:12 +00:00
|
|
|
struct stripe_head *sh, int disks);
|
2017-03-09 08:59:58 +00:00
|
|
|
extern int r5c_cache_data(struct r5l_log *log, struct stripe_head *sh);
|
|
|
|
extern void r5c_make_stripe_write_out(struct stripe_head *sh);
|
|
|
|
extern void r5c_flush_cache(struct r5conf *conf, int num);
|
|
|
|
extern void r5c_check_stripe_cache_usage(struct r5conf *conf);
|
|
|
|
extern void r5c_check_cached_full_stripe(struct r5conf *conf);
|
|
|
|
extern struct md_sysfs_entry r5c_journal_mode;
|
md/r5cache: gracefully handle journal device errors for writeback mode
For the raid456 with writeback cache, when journal device failed during
normal operation, it is still possible to persist all data, as all
pending data is still in stripe cache. However, it is necessary to handle
journal failure gracefully.
During journal failures, the following logic handles the graceful shutdown
of journal:
1. raid5_error() marks the device as Faulty and schedules async work
log->disable_writeback_work;
2. In disable_writeback_work (r5c_disable_writeback_async), the mddev is
suspended, set to write through, and then resumed. mddev_suspend()
flushes all cached stripes;
3. All cached stripes need to be flushed carefully to the RAID array.
This patch fixes issues within the process above:
1. In r5c_update_on_rdev_error() schedule disable_writeback_work for
journal failures;
2. In r5c_disable_writeback_async(), wait for MD_SB_CHANGE_PENDING,
since raid5_error() updates superblock.
3. In handle_stripe(), allow stripes with data in journal (s.injournal > 0)
to make progress during log_failed;
4. In delay_towrite(), if log failed only process data in the cache (skip
new writes in dev->towrite);
5. In __get_priority_stripe(), process loprio_list during journal device
failures.
6. In raid5_remove_disk(), wait for all cached stripes are flushed before
calling log_exit().
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
2017-05-11 22:28:28 +00:00
|
|
|
extern void r5c_update_on_rdev_error(struct mddev *mddev,
|
|
|
|
struct md_rdev *rdev);
|
2017-03-09 08:59:58 +00:00
|
|
|
extern bool r5c_big_stripe_cached(struct r5conf *conf, sector_t sect);
|
2017-11-20 06:17:01 +00:00
|
|
|
extern int r5l_start(struct r5l_log *log);
|
2017-03-09 08:59:58 +00:00
|
|
|
|
2017-03-09 08:59:59 +00:00
|
|
|
extern struct dma_async_tx_descriptor *
|
|
|
|
ops_run_partial_parity(struct stripe_head *sh, struct raid5_percpu *percpu,
|
|
|
|
struct dma_async_tx_descriptor *tx);
|
|
|
|
extern int ppl_init_log(struct r5conf *conf);
|
|
|
|
extern void ppl_exit_log(struct r5conf *conf);
|
|
|
|
extern int ppl_write_stripe(struct r5conf *conf, struct stripe_head *sh);
|
|
|
|
extern void ppl_write_stripe_run(struct r5conf *conf);
|
|
|
|
extern void ppl_stripe_write_finished(struct stripe_head *sh);
|
2017-03-09 09:00:02 +00:00
|
|
|
extern int ppl_modify_log(struct r5conf *conf, struct md_rdev *rdev, bool add);
|
2017-12-27 09:31:40 +00:00
|
|
|
extern void ppl_quiesce(struct r5conf *conf, int quiesce);
|
2018-02-20 09:10:36 +00:00
|
|
|
extern int ppl_handle_flush_request(struct r5l_log *log, struct bio *bio);
|
2017-03-09 08:59:59 +00:00
|
|
|
|
2018-08-29 18:05:42 +00:00
|
|
|
static inline bool raid5_has_log(struct r5conf *conf)
|
|
|
|
{
|
|
|
|
return test_bit(MD_HAS_JOURNAL, &conf->mddev->flags);
|
|
|
|
}
|
|
|
|
|
2017-03-09 08:59:59 +00:00
|
|
|
static inline bool raid5_has_ppl(struct r5conf *conf)
|
|
|
|
{
|
|
|
|
return test_bit(MD_HAS_PPL, &conf->mddev->flags);
|
|
|
|
}
|
|
|
|
|
2017-03-09 08:59:58 +00:00
|
|
|
static inline int log_stripe(struct stripe_head *sh, struct stripe_head_state *s)
|
|
|
|
{
|
|
|
|
struct r5conf *conf = sh->raid_conf;
|
|
|
|
|
|
|
|
if (conf->log) {
|
|
|
|
if (!test_bit(STRIPE_R5C_CACHING, &sh->state)) {
|
|
|
|
/* writing out phase */
|
|
|
|
if (s->waiting_extra_page)
|
|
|
|
return 0;
|
|
|
|
return r5l_write_stripe(conf->log, sh);
|
|
|
|
} else if (test_bit(STRIPE_LOG_TRAPPED, &sh->state)) {
|
|
|
|
/* caching phase */
|
|
|
|
return r5c_cache_data(conf->log, sh);
|
|
|
|
}
|
2017-03-09 08:59:59 +00:00
|
|
|
} else if (raid5_has_ppl(conf)) {
|
|
|
|
return ppl_write_stripe(conf, sh);
|
2017-03-09 08:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return -EAGAIN;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void log_stripe_write_finished(struct stripe_head *sh)
|
|
|
|
{
|
|
|
|
struct r5conf *conf = sh->raid_conf;
|
|
|
|
|
|
|
|
if (conf->log)
|
|
|
|
r5l_stripe_write_finished(sh);
|
2017-03-09 08:59:59 +00:00
|
|
|
else if (raid5_has_ppl(conf))
|
|
|
|
ppl_stripe_write_finished(sh);
|
2017-03-09 08:59:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void log_write_stripe_run(struct r5conf *conf)
|
|
|
|
{
|
|
|
|
if (conf->log)
|
|
|
|
r5l_write_stripe_run(conf->log);
|
2017-03-09 08:59:59 +00:00
|
|
|
else if (raid5_has_ppl(conf))
|
|
|
|
ppl_write_stripe_run(conf);
|
2017-03-09 08:59:58 +00:00
|
|
|
}
|
|
|
|
|
2017-12-27 09:31:40 +00:00
|
|
|
static inline void log_flush_stripe_to_raid(struct r5conf *conf)
|
|
|
|
{
|
|
|
|
if (conf->log)
|
|
|
|
r5l_flush_stripe_to_raid(conf->log);
|
|
|
|
else if (raid5_has_ppl(conf))
|
|
|
|
ppl_write_stripe_run(conf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int log_handle_flush_request(struct r5conf *conf, struct bio *bio)
|
|
|
|
{
|
|
|
|
int ret = -ENODEV;
|
|
|
|
|
|
|
|
if (conf->log)
|
|
|
|
ret = r5l_handle_flush_request(conf->log, bio);
|
|
|
|
else if (raid5_has_ppl(conf))
|
2018-02-20 09:10:36 +00:00
|
|
|
ret = ppl_handle_flush_request(conf->log, bio);
|
2017-12-27 09:31:40 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void log_quiesce(struct r5conf *conf, int quiesce)
|
|
|
|
{
|
|
|
|
if (conf->log)
|
|
|
|
r5l_quiesce(conf->log, quiesce);
|
|
|
|
else if (raid5_has_ppl(conf))
|
|
|
|
ppl_quiesce(conf, quiesce);
|
|
|
|
}
|
|
|
|
|
2017-03-09 08:59:58 +00:00
|
|
|
static inline void log_exit(struct r5conf *conf)
|
|
|
|
{
|
|
|
|
if (conf->log)
|
|
|
|
r5l_exit_log(conf);
|
2017-03-09 08:59:59 +00:00
|
|
|
else if (raid5_has_ppl(conf))
|
|
|
|
ppl_exit_log(conf);
|
2017-03-09 08:59:58 +00:00
|
|
|
}
|
|
|
|
|
2017-04-04 11:13:57 +00:00
|
|
|
static inline int log_init(struct r5conf *conf, struct md_rdev *journal_dev,
|
|
|
|
bool ppl)
|
2017-03-09 08:59:58 +00:00
|
|
|
{
|
|
|
|
if (journal_dev)
|
|
|
|
return r5l_init_log(conf, journal_dev);
|
2017-04-04 11:13:57 +00:00
|
|
|
else if (ppl)
|
2017-03-09 08:59:59 +00:00
|
|
|
return ppl_init_log(conf);
|
2017-03-09 08:59:58 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-09 09:00:02 +00:00
|
|
|
static inline int log_modify(struct r5conf *conf, struct md_rdev *rdev, bool add)
|
|
|
|
{
|
|
|
|
if (raid5_has_ppl(conf))
|
|
|
|
return ppl_modify_log(conf, rdev, add);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-09 08:59:58 +00:00
|
|
|
#endif
|