<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/stat.h, branch v6.12.80</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.12.80'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2024-06-20T21:19:17+00:00</updated>
<entry>
<title>fs: Add initial atomic write support info to statx</title>
<updated>2024-06-20T21:19:17+00:00</updated>
<author>
<name>Prasad Singamsetty</name>
<email>prasad.singamsetty@oracle.com</email>
</author>
<published>2024-06-20T12:53:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0f9ca80fa4f9670ba09721e4e36b8baf086a500c'/>
<id>urn:sha1:0f9ca80fa4f9670ba09721e4e36b8baf086a500c</id>
<content type='text'>
Extend statx system call to return additional info for atomic write support
support for a file.

Helper function generic_fill_statx_atomic_writes() can be used by FSes to
fill in the relevant statx fields. For now atomic_write_segments_max will
always be 1, otherwise some rules would need to be imposed on iovec length
and alignment, which we don't want now.

Signed-off-by: Prasad Singamsetty &lt;prasad.singamsetty@oracle.com&gt;
jpg: relocate bdev support to another patch
Reviewed-by: Darrick J. Wong &lt;djwong@kernel.org&gt;
Reviewed-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Signed-off-by: John Garry &lt;john.g.garry@oracle.com&gt;
Acked-by: Darrick J. Wong &lt;djwong@kernel.org&gt;
Link: https://lore.kernel.org/r/20240620125359.2684798-5-john.g.garry@oracle.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>statx: stx_subvol</title>
<updated>2024-03-26T08:01:18+00:00</updated>
<author>
<name>Kent Overstreet</name>
<email>kent.overstreet@linux.dev</email>
</author>
<published>2024-03-08T02:29:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2a82bb02941fb53d1f8df2a360e7798ae3d9d962'/>
<id>urn:sha1:2a82bb02941fb53d1f8df2a360e7798ae3d9d962</id>
<content type='text'>
Add a new statx field for (sub)volume identifiers, as implemented by
btrfs and bcachefs.

This includes bcachefs support; we'll definitely want btrfs support as
well.

Link: https://lore.kernel.org/linux-fsdevel/2uvhm6gweyl7iyyp2xpfryvcu2g3padagaeqcbiavjyiis6prl@yjm725bizncq/
Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
Cc: Josef Bacik &lt;josef@toxicpanda.com&gt;
Cc: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Cc: Christian Brauner &lt;brauner@kernel.org&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: Kent Overstreet &lt;kent.overstreet@linux.dev&gt;
Link: https://lore.kernel.org/r/20240308022914.196982-1-kent.overstreet@linux.dev
Signed-off-by: Johannes Thumshirn &lt;johannes.thumshirn@wdc.com&gt;
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
<entry>
<title>vfs: plumb i_version handling into struct kstat</title>
<updated>2023-01-26T12:00:06+00:00</updated>
<author>
<name>Jeff Layton</name>
<email>jlayton@redhat.com</email>
</author>
<published>2016-12-04T14:29:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a1175d6b1bdaf4f74eda47ab18eb44194f9cb796'/>
<id>urn:sha1:a1175d6b1bdaf4f74eda47ab18eb44194f9cb796</id>
<content type='text'>
The NFS server has a lot of special handling for different types of
change attribute access, depending on the underlying filesystem. In
most cases, it's doing a getattr anyway and then fetching that value
after the fact.

Rather that do that, add a new STATX_CHANGE_COOKIE flag that is a
kernel-only symbol (for now). If requested and getattr can implement it,
it can fill out this field. For IS_I_VERSION inodes, add a generic
implementation in vfs_getattr_nosec. Take care to mask
STATX_CHANGE_COOKIE off in requests from userland and in the result
mask.

Since not all filesystems can give the same guarantees of monotonicity,
claim a STATX_ATTR_CHANGE_MONOTONIC flag that filesystems can set to
indicate that they offer an i_version value that can never go backward.

Eventually if we decide to make the i_version available to userland, we
can just designate a field for it in struct statx, and move the
STATX_CHANGE_COOKIE definition to the uapi header.

Reviewed-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Jeff Layton &lt;jlayton@kernel.org&gt;
</content>
</entry>
<entry>
<title>statx: add direct I/O alignment information</title>
<updated>2022-09-12T00:47:04+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2022-08-27T06:58:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=825cf206ed510c4a1758bef8957e2b039253e2e3'/>
<id>urn:sha1:825cf206ed510c4a1758bef8957e2b039253e2e3</id>
<content type='text'>
Traditionally, the conditions for when DIO (direct I/O) is supported
were fairly simple.  For both block devices and regular files, DIO had
to be aligned to the logical block size of the block device.

However, due to filesystem features that have been added over time (e.g.
multi-device support, data journalling, inline data, encryption, verity,
compression, checkpoint disabling, log-structured mode), the conditions
for when DIO is allowed on a regular file have gotten increasingly
complex.  Whether a particular regular file supports DIO, and with what
alignment, can depend on various file attributes and filesystem mount
options, as well as which block device(s) the file's data is located on.

Moreover, the general rule of DIO needing to be aligned to the block
device's logical block size was recently relaxed to allow user buffers
(but not file offsets) aligned to the DMA alignment instead.  See
commit bf8d08532bc1 ("iomap: add support for dma aligned direct-io").

XFS has an ioctl XFS_IOC_DIOINFO that exposes DIO alignment information.
Uplifting this to the VFS is one possibility.  However, as discussed
(https://lore.kernel.org/linux-fsdevel/20220120071215.123274-1-ebiggers@kernel.org/T/#u),
this ioctl is rarely used and not known to be used outside of
XFS-specific code.  It was also never intended to indicate when a file
doesn't support DIO at all, nor was it intended for block devices.

Therefore, let's expose this information via statx().  Add the
STATX_DIOALIGN flag and two new statx fields associated with it:

* stx_dio_mem_align: the alignment (in bytes) required for user memory
  buffers for DIO, or 0 if DIO is not supported on the file.

* stx_dio_offset_align: the alignment (in bytes) required for file
  offsets and I/O segment lengths for DIO, or 0 if DIO is not supported
  on the file.  This will only be nonzero if stx_dio_mem_align is
  nonzero, and vice versa.

Note that as with other statx() extensions, if STATX_DIOALIGN isn't set
in the returned statx struct, then these new fields won't be filled in.
This will happen if the file is neither a regular file nor a block
device, or if the file is a regular file and the filesystem doesn't
support STATX_DIOALIGN.  It might also happen if the caller didn't
include STATX_DIOALIGN in the request mask, since statx() isn't required
to return unrequested information.

This commit only adds the VFS-level plumbing for STATX_DIOALIGN.  For
regular files, individual filesystems will still need to add code to
support it.  For block devices, a separate commit will wire it up too.

Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Darrick J. Wong &lt;djwong@kernel.org&gt;
Reviewed-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Reviewed-by: Christian Brauner (Microsoft) &lt;brauner@kernel.org&gt;
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Link: https://lore.kernel.org/r/20220827065851.135710-2-ebiggers@kernel.org
</content>
</entry>
<entry>
<title>fs: add generic helper for filling statx attribute flags</title>
<updated>2021-08-17T09:47:43+00:00</updated>
<author>
<name>Amir Goldstein</name>
<email>amir73il@gmail.com</email>
</author>
<published>2021-06-19T09:26:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4f911138c8da94bcff84f1d093d28e378703c43f'/>
<id>urn:sha1:4f911138c8da94bcff84f1d093d28e378703c43f</id>
<content type='text'>
The immutable and append-only properties on an inode are published on
the inode's i_flags and enforced by the VFS.

Create a helper to fill the corresponding STATX_ATTR_ flags in the kstat
structure from the inode's i_flags.

Only orange was converted to use this helper.
Other filesystems could use it in the future.

Suggested-by: Miklos Szeredi &lt;miklos@szeredi.hu&gt;
Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
</content>
</entry>
<entry>
<title>fs: remove KSTAT_QUERY_FLAGS</title>
<updated>2020-09-27T02:55:05+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-09-26T07:04:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f2d077ff1b5c17008cff5dc27e7356a694e55462'/>
<id>urn:sha1:f2d077ff1b5c17008cff5dc27e7356a694e55462</id>
<content type='text'>
KSTAT_QUERY_FLAGS expands to AT_STATX_SYNC_TYPE, which itself already
is a mask.  Remove the double name, especially given that the prefix
is a little confusing vs the normal AT_* flags.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>statx: add mount ID</title>
<updated>2020-05-14T14:44:24+00:00</updated>
<author>
<name>Miklos Szeredi</name>
<email>mszeredi@redhat.com</email>
</author>
<published>2020-05-14T14:44:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60'/>
<id>urn:sha1:fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60</id>
<content type='text'>
Systemd is hacking around to get it and it's trivial to add to statx, so...

Cc: linux-api@vger.kernel.org
Cc: linux-man@vger.kernel.org
Signed-off-by: Miklos Szeredi &lt;mszeredi@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>statx: define STATX_ATTR_VERITY</title>
<updated>2019-11-13T20:15:34+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2019-10-29T20:41:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3ad2522c64cff1f5aebb987b00683268f0cc7c29'/>
<id>urn:sha1:3ad2522c64cff1f5aebb987b00683268f0cc7c29</id>
<content type='text'>
Add a statx attribute bit STATX_ATTR_VERITY which will be set if the
file has fs-verity enabled.  This is the statx() equivalent of
FS_VERITY_FL which is returned by FS_IOC_GETFLAGS.

This is useful because it allows applications to check whether a file is
a verity file without opening it.  Opening a verity file can be
expensive because the fsverity_info is set up on open, which involves
parsing metadata and optionally verifying a cryptographic signature.

This is analogous to how various other bits are exposed through both
FS_IOC_GETFLAGS and statx(), e.g. the encrypt bit.

Reviewed-by: Andreas Dilger &lt;adilger@dilger.ca&gt;
Acked-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
</content>
</entry>
<entry>
<title>vfs: change inode times to use struct timespec64</title>
<updated>2018-06-05T23:57:31+00:00</updated>
<author>
<name>Deepa Dinamani</name>
<email>deepa.kernel@gmail.com</email>
</author>
<published>2018-05-09T02:36:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=95582b00838837fc07e042979320caf917ce3fe6'/>
<id>urn:sha1:95582b00838837fc07e042979320caf917ce3fe6</id>
<content type='text'>
struct timespec is not y2038 safe. Transition vfs to use
y2038 safe struct timespec64 instead.

The change was made with the help of the following cocinelle
script. This catches about 80% of the changes.
All the header file and logic changes are included in the
first 5 rules. The rest are trivial substitutions.
I avoid changing any of the function signatures or any other
filesystem specific data structures to keep the patch simple
for review.

The script can be a little shorter by combining different cases.
But, this version was sufficient for my usecase.

virtual patch

@ depends on patch @
identifier now;
@@
- struct timespec
+ struct timespec64
  current_time ( ... )
  {
- struct timespec now = current_kernel_time();
+ struct timespec64 now = current_kernel_time64();
  ...
- return timespec_trunc(
+ return timespec64_trunc(
  ... );
  }

@ depends on patch @
identifier xtime;
@@
 struct \( iattr \| inode \| kstat \) {
 ...
-       struct timespec xtime;
+       struct timespec64 xtime;
 ...
 }

@ depends on patch @
identifier t;
@@
 struct inode_operations {
 ...
int (*update_time) (...,
-       struct timespec t,
+       struct timespec64 t,
...);
 ...
 }

@ depends on patch @
identifier t;
identifier fn_update_time =~ "update_time$";
@@
 fn_update_time (...,
- struct timespec *t,
+ struct timespec64 *t,
 ...) { ... }

@ depends on patch @
identifier t;
@@
lease_get_mtime( ... ,
- struct timespec *t
+ struct timespec64 *t
  ) { ... }

@te depends on patch forall@
identifier ts;
local idexpression struct inode *inode_node;
identifier i_xtime =~ "^i_[acm]time$";
identifier ia_xtime =~ "^ia_[acm]time$";
identifier fn_update_time =~ "update_time$";
identifier fn;
expression e, E3;
local idexpression struct inode *node1;
local idexpression struct inode *node2;
local idexpression struct iattr *attr1;
local idexpression struct iattr *attr2;
local idexpression struct iattr attr;
identifier i_xtime1 =~ "^i_[acm]time$";
identifier i_xtime2 =~ "^i_[acm]time$";
identifier ia_xtime1 =~ "^ia_[acm]time$";
identifier ia_xtime2 =~ "^ia_[acm]time$";
@@
(
(
- struct timespec ts;
+ struct timespec64 ts;
|
- struct timespec ts = current_time(inode_node);
+ struct timespec64 ts = current_time(inode_node);
)

&lt;+... when != ts
(
- timespec_equal(&amp;inode_node-&gt;i_xtime, &amp;ts)
+ timespec64_equal(&amp;inode_node-&gt;i_xtime, &amp;ts)
|
- timespec_equal(&amp;ts, &amp;inode_node-&gt;i_xtime)
+ timespec64_equal(&amp;ts, &amp;inode_node-&gt;i_xtime)
|
- timespec_compare(&amp;inode_node-&gt;i_xtime, &amp;ts)
+ timespec64_compare(&amp;inode_node-&gt;i_xtime, &amp;ts)
|
- timespec_compare(&amp;ts, &amp;inode_node-&gt;i_xtime)
+ timespec64_compare(&amp;ts, &amp;inode_node-&gt;i_xtime)
|
ts = current_time(e)
|
fn_update_time(..., &amp;ts,...)
|
inode_node-&gt;i_xtime = ts
|
node1-&gt;i_xtime = ts
|
ts = inode_node-&gt;i_xtime
|
&lt;+... attr1-&gt;ia_xtime ...+&gt; = ts
|
ts = attr1-&gt;ia_xtime
|
ts.tv_sec
|
ts.tv_nsec
|
btrfs_set_stack_timespec_sec(..., ts.tv_sec)
|
btrfs_set_stack_timespec_nsec(..., ts.tv_nsec)
|
- ts = timespec64_to_timespec(
+ ts =
...
-)
|
- ts = ktime_to_timespec(
+ ts = ktime_to_timespec64(
...)
|
- ts = E3
+ ts = timespec_to_timespec64(E3)
|
- ktime_get_real_ts(&amp;ts)
+ ktime_get_real_ts64(&amp;ts)
|
fn(...,
- ts
+ timespec64_to_timespec(ts)
,...)
)
...+&gt;
(
&lt;... when != ts
- return ts;
+ return timespec64_to_timespec(ts);
...&gt;
)
|
- timespec_equal(&amp;node1-&gt;i_xtime1, &amp;node2-&gt;i_xtime2)
+ timespec64_equal(&amp;node1-&gt;i_xtime2, &amp;node2-&gt;i_xtime2)
|
- timespec_equal(&amp;node1-&gt;i_xtime1, &amp;attr2-&gt;ia_xtime2)
+ timespec64_equal(&amp;node1-&gt;i_xtime2, &amp;attr2-&gt;ia_xtime2)
|
- timespec_compare(&amp;node1-&gt;i_xtime1, &amp;node2-&gt;i_xtime2)
+ timespec64_compare(&amp;node1-&gt;i_xtime1, &amp;node2-&gt;i_xtime2)
|
node1-&gt;i_xtime1 =
- timespec_trunc(attr1-&gt;ia_xtime1,
+ timespec64_trunc(attr1-&gt;ia_xtime1,
...)
|
- attr1-&gt;ia_xtime1 = timespec_trunc(attr2-&gt;ia_xtime2,
+ attr1-&gt;ia_xtime1 =  timespec64_trunc(attr2-&gt;ia_xtime2,
...)
|
- ktime_get_real_ts(&amp;attr1-&gt;ia_xtime1)
+ ktime_get_real_ts64(&amp;attr1-&gt;ia_xtime1)
|
- ktime_get_real_ts(&amp;attr.ia_xtime1)
+ ktime_get_real_ts64(&amp;attr.ia_xtime1)
)

@ depends on patch @
struct inode *node;
struct iattr *attr;
identifier fn;
identifier i_xtime =~ "^i_[acm]time$";
identifier ia_xtime =~ "^ia_[acm]time$";
expression e;
@@
(
- fn(node-&gt;i_xtime);
+ fn(timespec64_to_timespec(node-&gt;i_xtime));
|
 fn(...,
- node-&gt;i_xtime);
+ timespec64_to_timespec(node-&gt;i_xtime));
|
- e = fn(attr-&gt;ia_xtime);
+ e = fn(timespec64_to_timespec(attr-&gt;ia_xtime));
)

@ depends on patch forall @
struct inode *node;
struct iattr *attr;
identifier i_xtime =~ "^i_[acm]time$";
identifier ia_xtime =~ "^ia_[acm]time$";
identifier fn;
@@
{
+ struct timespec ts;
&lt;+...
(
+ ts = timespec64_to_timespec(node-&gt;i_xtime);
fn (...,
- &amp;node-&gt;i_xtime,
+ &amp;ts,
...);
|
+ ts = timespec64_to_timespec(attr-&gt;ia_xtime);
fn (...,
- &amp;attr-&gt;ia_xtime,
+ &amp;ts,
...);
)
...+&gt;
}

@ depends on patch forall @
struct inode *node;
struct iattr *attr;
struct kstat *stat;
identifier ia_xtime =~ "^ia_[acm]time$";
identifier i_xtime =~ "^i_[acm]time$";
identifier xtime =~ "^[acm]time$";
identifier fn, ret;
@@
{
+ struct timespec ts;
&lt;+...
(
+ ts = timespec64_to_timespec(node-&gt;i_xtime);
ret = fn (...,
- &amp;node-&gt;i_xtime,
+ &amp;ts,
...);
|
+ ts = timespec64_to_timespec(node-&gt;i_xtime);
ret = fn (...,
- &amp;node-&gt;i_xtime);
+ &amp;ts);
|
+ ts = timespec64_to_timespec(attr-&gt;ia_xtime);
ret = fn (...,
- &amp;attr-&gt;ia_xtime,
+ &amp;ts,
...);
|
+ ts = timespec64_to_timespec(attr-&gt;ia_xtime);
ret = fn (...,
- &amp;attr-&gt;ia_xtime);
+ &amp;ts);
|
+ ts = timespec64_to_timespec(stat-&gt;xtime);
ret = fn (...,
- &amp;stat-&gt;xtime);
+ &amp;ts);
)
...+&gt;
}

@ depends on patch @
struct inode *node;
struct inode *node2;
identifier i_xtime1 =~ "^i_[acm]time$";
identifier i_xtime2 =~ "^i_[acm]time$";
identifier i_xtime3 =~ "^i_[acm]time$";
struct iattr *attrp;
struct iattr *attrp2;
struct iattr attr ;
identifier ia_xtime1 =~ "^ia_[acm]time$";
identifier ia_xtime2 =~ "^ia_[acm]time$";
struct kstat *stat;
struct kstat stat1;
struct timespec64 ts;
identifier xtime =~ "^[acmb]time$";
expression e;
@@
(
( node-&gt;i_xtime2 \| attrp-&gt;ia_xtime2 \| attr.ia_xtime2 \) = node-&gt;i_xtime1  ;
|
 node-&gt;i_xtime2 = \( node2-&gt;i_xtime1 \| timespec64_trunc(...) \);
|
 node-&gt;i_xtime2 = node-&gt;i_xtime1 = node-&gt;i_xtime3 = \(ts \| current_time(...) \);
|
 node-&gt;i_xtime1 = node-&gt;i_xtime3 = \(ts \| current_time(...) \);
|
 stat-&gt;xtime = node2-&gt;i_xtime1;
|
 stat1.xtime = node2-&gt;i_xtime1;
|
( node-&gt;i_xtime2 \| attrp-&gt;ia_xtime2 \) = attrp-&gt;ia_xtime1  ;
|
( attrp-&gt;ia_xtime1 \| attr.ia_xtime1 \) = attrp2-&gt;ia_xtime2;
|
- e = node-&gt;i_xtime1;
+ e = timespec64_to_timespec( node-&gt;i_xtime1 );
|
- e = attrp-&gt;ia_xtime1;
+ e = timespec64_to_timespec( attrp-&gt;ia_xtime1 );
|
node-&gt;i_xtime1 = current_time(...);
|
 node-&gt;i_xtime2 = node-&gt;i_xtime1 = node-&gt;i_xtime3 =
- e;
+ timespec_to_timespec64(e);
|
 node-&gt;i_xtime1 = node-&gt;i_xtime3 =
- e;
+ timespec_to_timespec64(e);
|
- node-&gt;i_xtime1 = e;
+ node-&gt;i_xtime1 = timespec_to_timespec64(e);
)

Signed-off-by: Deepa Dinamani &lt;deepa.kernel@gmail.com&gt;
Cc: &lt;anton@tuxera.com&gt;
Cc: &lt;balbi@kernel.org&gt;
Cc: &lt;bfields@fieldses.org&gt;
Cc: &lt;darrick.wong@oracle.com&gt;
Cc: &lt;dhowells@redhat.com&gt;
Cc: &lt;dsterba@suse.com&gt;
Cc: &lt;dwmw2@infradead.org&gt;
Cc: &lt;hch@lst.de&gt;
Cc: &lt;hirofumi@mail.parknet.co.jp&gt;
Cc: &lt;hubcap@omnibond.com&gt;
Cc: &lt;jack@suse.com&gt;
Cc: &lt;jaegeuk@kernel.org&gt;
Cc: &lt;jaharkes@cs.cmu.edu&gt;
Cc: &lt;jslaby@suse.com&gt;
Cc: &lt;keescook@chromium.org&gt;
Cc: &lt;mark@fasheh.com&gt;
Cc: &lt;miklos@szeredi.hu&gt;
Cc: &lt;nico@linaro.org&gt;
Cc: &lt;reiserfs-devel@vger.kernel.org&gt;
Cc: &lt;richard@nod.at&gt;
Cc: &lt;sage@redhat.com&gt;
Cc: &lt;sfrench@samba.org&gt;
Cc: &lt;swhiteho@redhat.com&gt;
Cc: &lt;tj@kernel.org&gt;
Cc: &lt;trond.myklebust@primarydata.com&gt;
Cc: &lt;tytso@mit.edu&gt;
Cc: &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>License cleanup: add SPDX GPL-2.0 license identifier to files with no license</title>
<updated>2017-11-02T10:10:55+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2017-11-01T14:07:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=b24413180f5600bcb3bb70fbed5cf186b60864bd'/>
<id>urn:sha1:b24413180f5600bcb3bb70fbed5cf186b60864bd</id>
<content type='text'>
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 &amp; 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 &gt;5
   lines of source
 - File already had some variant of a license header in it (even if &lt;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 &lt;kstewart@linuxfoundation.org&gt;
Reviewed-by: Philippe Ombredanne &lt;pombredanne@nexb.com&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
