<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/fs, branch tegra</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>vfs: make O_PATH file descriptors usable for 'fchdir()'</title>
<updated>2017-12-21T01:07:39+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2012-07-07T17:17:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8882661bb6d0b0a1bf0d711683e6895abb64c40a'/>
<id>8882661bb6d0b0a1bf0d711683e6895abb64c40a</id>
<content type='text'>
We already use them for openat() and friends, but fchdir() also wants to
be able to use O_PATH file descriptors.  This should make it comparable
to the O_SEARCH of Solaris.  In particular, O_PATH allows you to access
(not-quite-open) a directory you don't have read persmission to, only
execute permission.

Noticed during development of multithread support for ksh93.

Reported-by: ольга крыжановская &lt;olga.kryzhanovska@gmail.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: stable@kernel.org    # O_PATH introduced in 3.0+
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
(cherry picked from commit 332a2e1244bd08b9e3ecd378028513396a004a24)
Signed-off-by: Dominik Sliwa &lt;dominik.sliwa@toradex.com&gt;
Acked-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We already use them for openat() and friends, but fchdir() also wants to
be able to use O_PATH file descriptors.  This should make it comparable
to the O_SEARCH of Solaris.  In particular, O_PATH allows you to access
(not-quite-open) a directory you don't have read persmission to, only
execute permission.

Noticed during development of multithread support for ksh93.

Reported-by: ольга крыжановская &lt;olga.kryzhanovska@gmail.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: stable@kernel.org    # O_PATH introduced in 3.0+
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
(cherry picked from commit 332a2e1244bd08b9e3ecd378028513396a004a24)
Signed-off-by: Dominik Sliwa &lt;dominik.sliwa@toradex.com&gt;
Acked-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>vfs: make O_PATH file descriptors usable for 'fstat()'</title>
<updated>2017-12-21T01:07:29+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2012-09-14T21:48:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d7ac775674f2c302992311c92af50dee229faa5f'/>
<id>d7ac775674f2c302992311c92af50dee229faa5f</id>
<content type='text'>
We already use them for openat() and friends, but fstat() also wants to
be able to use O_PATH file descriptors.  This should make it more
directly comparable to the O_SEARCH of Solaris.

Note that you could already do the same thing with "fstatat()" and an
empty path, but just doing "fstat()" directly is simpler and faster, so
there is no reason not to just allow it directly.

See also commit 332a2e1244bd, which did the same thing for fchdir, for
the same reasons.

Reported-by: ольга крыжановская &lt;olga.kryzhanovska@gmail.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: stable@kernel.org    # O_PATH introduced in 3.0+
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
(cherry picked from commit 55815f70147dcfa3ead5738fd56d3574e2e3c1c2)
Signed-off-by: Dominik Sliwa &lt;dominik.sliwa@toradex.com&gt;
Acked-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We already use them for openat() and friends, but fstat() also wants to
be able to use O_PATH file descriptors.  This should make it more
directly comparable to the O_SEARCH of Solaris.

Note that you could already do the same thing with "fstatat()" and an
empty path, but just doing "fstat()" directly is simpler and faster, so
there is no reason not to just allow it directly.

See also commit 332a2e1244bd, which did the same thing for fchdir, for
the same reasons.

Reported-by: ольга крыжановская &lt;olga.kryzhanovska@gmail.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: stable@kernel.org    # O_PATH introduced in 3.0+
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
(cherry picked from commit 55815f70147dcfa3ead5738fd56d3574e2e3c1c2)
Signed-off-by: Dominik Sliwa &lt;dominik.sliwa@toradex.com&gt;
Acked-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>VFS: make vfs_fstat() use f[get|put]_light()</title>
<updated>2017-12-21T01:07:19+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2012-04-28T21:55:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=091f708e28ebfc999395fa6d3137871d573ed623'/>
<id>091f708e28ebfc999395fa6d3137871d573ed623</id>
<content type='text'>
Use the *_light() versions that properly avoid doing the file user count
updates when they are unnecessary.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
(cherry picked from commit e994defb7b6813ba6fa7a2a36e86d2455ad1dc35)
Signed-off-by: Dominik Sliwa &lt;dominik.sliwa@toradex.com&gt;
Acked-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use the *_light() versions that properly avoid doing the file user count
updates when they are unnecessary.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
(cherry picked from commit e994defb7b6813ba6fa7a2a36e86d2455ad1dc35)
Signed-off-by: Dominik Sliwa &lt;dominik.sliwa@toradex.com&gt;
Acked-by: Marcel Ziswiler &lt;marcel.ziswiler@toradex.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge remote-tracking branch 'remotes/ubifs-v3.1/master' into tegra-nand-next</title>
<updated>2015-03-30T12:04:31+00:00</updated>
<author>
<name>Marcel Ziswiler</name>
<email>marcel.ziswiler@toradex.com</email>
</author>
<published>2015-03-30T12:04:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a23184ff45e565dc7275fa5b49aca4cd2762a4c6'/>
<id>a23184ff45e565dc7275fa5b49aca4cd2762a4c6</id>
<content type='text'>
Conflicts:
	drivers/mtd/ubi/ubi.h
	drivers/mtd/ubi/wl.c
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	drivers/mtd/ubi/ubi.h
	drivers/mtd/ubi/wl.c
</pre>
</div>
</content>
</entry>
<entry>
<title>yaffs: fix spinning when flush inodes</title>
<updated>2014-10-28T13:42:35+00:00</updated>
<author>
<name>Stefan Agner</name>
<email>stefan.agner@toradex.com</email>
</author>
<published>2014-09-19T12:09:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=88ffc75a690481a20bf8dd2b864f3ba91a698532'/>
<id>88ffc75a690481a20bf8dd2b864f3ba91a698532</id>
<content type='text'>
While in list_for_each_entry() of yaffs_flush_inodes, the fs code
can delete inodes. This leads to an endless loop which causes a
softlockup. Typically this happend in sync_supers when creating
and deleting files while under CPU load.

This fix checks whether we get twice the same inode. If this is
true, we just retry again.

This is an alternative fix to the proposed fix Jisheng Zhang:
yaffs: fix softlockup cauesed by inode deleted when scanning s_inodes list
http://www.aleph1.co.uk/lurker/message/20110831.075307.3cfeacdf.fr.html
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While in list_for_each_entry() of yaffs_flush_inodes, the fs code
can delete inodes. This leads to an endless loop which causes a
softlockup. Typically this happend in sync_supers when creating
and deleting files while under CPU load.

This fix checks whether we get twice the same inode. If this is
true, we just retry again.

This is an alternative fix to the proposed fix Jisheng Zhang:
yaffs: fix softlockup cauesed by inode deleted when scanning s_inodes list
http://www.aleph1.co.uk/lurker/message/20110831.075307.3cfeacdf.fr.html
</pre>
</div>
</content>
</entry>
<entry>
<title>yaffs: fix function prototype</title>
<updated>2014-09-25T13:21:40+00:00</updated>
<author>
<name>Stefan Agner</name>
<email>stefan.agner@toradex.com</email>
</author>
<published>2014-09-19T07:44:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=5fc897d5626f59d7fcda45d41401f0baaf558c1f'/>
<id>5fc897d5626f59d7fcda45d41401f0baaf558c1f</id>
<content type='text'>
The fsync function in the fs.h header file in our kernel version has
two additional function introduced by this commit:

02c24a82187d5a628c68edfe71ae60dc135cd178
fs: push i_mutex and filemap_write_and_wait down into -&gt;fsync() handlers

Update the function prototype for YAFFS2 too to avoid missinterpreted
datasync parameter and to avoid warnings.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The fsync function in the fs.h header file in our kernel version has
two additional function introduced by this commit:

02c24a82187d5a628c68edfe71ae60dc135cd178
fs: push i_mutex and filemap_write_and_wait down into -&gt;fsync() handlers

Update the function prototype for YAFFS2 too to avoid missinterpreted
datasync parameter and to avoid warnings.
</pre>
</div>
</content>
</entry>
<entry>
<title>UBIFS: fix a horrid bug</title>
<updated>2013-07-05T15:19:48+00:00</updated>
<author>
<name>Artem Bityutskiy</name>
<email>artem.bityutskiy@linux.intel.com</email>
</author>
<published>2013-06-28T11:15:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=67a2c95b17b16316bed53dcb13da0c1875247580'/>
<id>67a2c95b17b16316bed53dcb13da0c1875247580</id>
<content type='text'>
Al Viro pointed me to the fact that '-&gt;readdir()' and '-&gt;llseek()' have no
mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
in the middle of 'ubifs_readdir()'.

This means that 'file-&gt;private_data' can be freed while 'ubifs_readdir()' uses
it, and this is a very bad bug: not only 'ubifs_readdir()' can return garbage,
but this may corrupt memory and lead to all kinds of problems like crashes an
security holes.

This patch fixes the problem by using the 'file-&gt;f_version' field, which
'-&gt;llseek()' always unconditionally sets to zero. We set it to 1 in
'ubifs_readdir()' and whenever we detect that it became 0, we know there was a
seek and it is time to clear the state saved in 'file-&gt;private_data'.

I tested this patch by writing a user-space program which runds readdir and
seek in parallell. I could easily crash the kernel without these patches, but
could not crash it with these patches.

Cc: stable@vger.kernel.org
Reported-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Tested-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Al Viro pointed me to the fact that '-&gt;readdir()' and '-&gt;llseek()' have no
mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
in the middle of 'ubifs_readdir()'.

This means that 'file-&gt;private_data' can be freed while 'ubifs_readdir()' uses
it, and this is a very bad bug: not only 'ubifs_readdir()' can return garbage,
but this may corrupt memory and lead to all kinds of problems like crashes an
security holes.

This patch fixes the problem by using the 'file-&gt;f_version' field, which
'-&gt;llseek()' always unconditionally sets to zero. We set it to 1 in
'ubifs_readdir()' and whenever we detect that it became 0, we know there was a
seek and it is time to clear the state saved in 'file-&gt;private_data'.

I tested this patch by writing a user-space program which runds readdir and
seek in parallell. I could easily crash the kernel without these patches, but
could not crash it with these patches.

Cc: stable@vger.kernel.org
Reported-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Tested-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>UBIFS: prepare to fix a horrid bug</title>
<updated>2013-07-05T15:17:09+00:00</updated>
<author>
<name>Artem Bityutskiy</name>
<email>artem.bityutskiy@linux.intel.com</email>
</author>
<published>2013-06-28T11:15:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a45a4546cd4c73d2fa9230c28fa823d22aa41959'/>
<id>a45a4546cd4c73d2fa9230c28fa823d22aa41959</id>
<content type='text'>
Al Viro pointed me to the fact that '-&gt;readdir()' and '-&gt;llseek()' have no
mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
in the middle of 'ubifs_readdir()'.

First of all, this means that 'file-&gt;private_data' can be freed while
'ubifs_readdir()' uses it.  But this particular patch does not fix the problem.
This patch is only a preparation, and the fix will follow next.

In this patch we make 'ubifs_readdir()' stop using 'file-&gt;f_pos' directly,
because 'file-&gt;f_pos' can be changed by '-&gt;llseek()' at any point. This may
lead 'ubifs_readdir()' to returning inconsistent data: directory entry names
may correspond to incorrect file positions.

So here we introduce a local variable 'pos', read 'file-&gt;f_pose' once at very
the beginning, and then stick to 'pos'. The result of this is that when
'ubifs_dir_llseek()' changes 'file-&gt;f_pos' while we are in the middle of
'ubifs_readdir()', the latter "wins".

Cc: stable@vger.kernel.org
Reported-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Tested-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Al Viro pointed me to the fact that '-&gt;readdir()' and '-&gt;llseek()' have no
mutual exclusion, which means the 'ubifs_dir_llseek()' can be run while we are
in the middle of 'ubifs_readdir()'.

First of all, this means that 'file-&gt;private_data' can be freed while
'ubifs_readdir()' uses it.  But this particular patch does not fix the problem.
This patch is only a preparation, and the fix will follow next.

In this patch we make 'ubifs_readdir()' stop using 'file-&gt;f_pos' directly,
because 'file-&gt;f_pos' can be changed by '-&gt;llseek()' at any point. This may
lead 'ubifs_readdir()' to returning inconsistent data: directory entry names
may correspond to incorrect file positions.

So here we introduce a local variable 'pos', read 'file-&gt;f_pose' once at very
the beginning, and then stick to 'pos'. The result of this is that when
'ubifs_dir_llseek()' changes 'file-&gt;f_pos' while we are in the middle of
'ubifs_readdir()', the latter "wins".

Cc: stable@vger.kernel.org
Reported-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Tested-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>UBIFS: correct mount message</title>
<updated>2013-07-05T15:17:09+00:00</updated>
<author>
<name>Richard Genoud</name>
<email>richard.genoud@gmail.com</email>
</author>
<published>2013-04-02T10:24:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6cb626e71ef4a7684ab73576def36cd5f4f3960b'/>
<id>6cb626e71ef4a7684ab73576def36cd5f4f3960b</id>
<content type='text'>
When mounting an UBIFS R/W volume, we have the message:
UBIFS: mounted UBI device 0, volume 1, name "rootfs"(null)
With this patch, we'll have:
UBIFS: mounted UBI device 0, volume 1, name "rootfs"
Which is, I think, what was intended.

Signed-off-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Cc: stable@vger.kernel.org [v3.7+]
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When mounting an UBIFS R/W volume, we have the message:
UBIFS: mounted UBI device 0, volume 1, name "rootfs"(null)
With this patch, we'll have:
UBIFS: mounted UBI device 0, volume 1, name "rootfs"
Which is, I think, what was intended.

Signed-off-by: Richard Genoud &lt;richard.genoud@gmail.com&gt;
Cc: stable@vger.kernel.org [v3.7+]
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>UBIFS: make space fixup work in the remount case</title>
<updated>2013-07-05T15:17:09+00:00</updated>
<author>
<name>Artem Bityutskiy</name>
<email>artem.bityutskiy@linux.intel.com</email>
</author>
<published>2013-03-14T08:49:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ba5dce01387650619456140baeed1013172e3e09'/>
<id>ba5dce01387650619456140baeed1013172e3e09</id>
<content type='text'>
The UBIFS space fixup is a useful feature which allows to fixup the "broken"
flash space at the time of the first mount. The "broken" space is usually the
result of using a "dumb" industrial flasher which is not able to skip empty
NAND pages and just writes all 0xFFs to the empty space, which has grave
side-effects for UBIFS when UBIFS trise to write useful data to those empty
pages.

The fix-up feature works roughly like this:
1. mkfs.ubifs sets the fixup flag in UBIFS superblock when creating the image
   (see -F option)
2. when the file-system is mounted for the first time, UBIFS notices the fixup
   flag and re-writes the entire media atomically, which may take really a lot
   of time.
3. UBIFS clears the fixup flag in the superblock.

This works fine when the file system is mounted R/W for the very first time.
But it did not really work in the case when we first mount the file-system R/O,
and then re-mount R/W. The reason was that we started the fixup procedure too
late, which we cannot really do because we have to fixup the space before it
starts being used.

Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Reported-by: Mark Jackson &lt;mpfj-list@mimc.co.uk&gt;
Cc: stable@vger.kernel.org # 3.0+
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The UBIFS space fixup is a useful feature which allows to fixup the "broken"
flash space at the time of the first mount. The "broken" space is usually the
result of using a "dumb" industrial flasher which is not able to skip empty
NAND pages and just writes all 0xFFs to the empty space, which has grave
side-effects for UBIFS when UBIFS trise to write useful data to those empty
pages.

The fix-up feature works roughly like this:
1. mkfs.ubifs sets the fixup flag in UBIFS superblock when creating the image
   (see -F option)
2. when the file-system is mounted for the first time, UBIFS notices the fixup
   flag and re-writes the entire media atomically, which may take really a lot
   of time.
3. UBIFS clears the fixup flag in the superblock.

This works fine when the file system is mounted R/W for the very first time.
But it did not really work in the case when we first mount the file-system R/O,
and then re-mount R/W. The reason was that we started the fixup procedure too
late, which we cannot really do because we have to fixup the space before it
starts being used.

Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Reported-by: Mark Jackson &lt;mpfj-list@mimc.co.uk&gt;
Cc: stable@vger.kernel.org # 3.0+
</pre>
</div>
</content>
</entry>
</feed>
