<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/ext4/namei.c, branch linux-3.14.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.14.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.14.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2015-05-06T19:59:15Z</updated>
<entry>
<title>ext4: make fsync to sync parent dir in no-journal for real this time</title>
<updated>2015-05-06T19:59:15Z</updated>
<author>
<name>Lukas Czerner</name>
</author>
<published>2015-04-03T14:46:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b19efa7293b2511537ebca09efdc2dabbdb80cf9'/>
<id>urn:sha1:b19efa7293b2511537ebca09efdc2dabbdb80cf9</id>
<content type='text'>
commit e12fb97222fc41e8442896934f76d39ef99b590a upstream.

Previously commit 14ece1028b3ed53ffec1b1213ffc6acaf79ad77c added a
support for for syncing parent directory of newly created inodes to
make sure that the inode is not lost after a power failure in
no-journal mode.

However this does not work in majority of cases, namely:
 - if the directory has inline data
 - if the directory is already indexed
 - if the directory already has at least one block and:
	- the new entry fits into it
	- or we've successfully converted it to indexed

So in those cases we might lose the inode entirely even after fsync in
the no-journal mode. This also includes ext2 default mode obviously.

I've noticed this while running xfstest generic/321 and even though the
test should fail (we need to run fsck after a crash in no-journal mode)
I could not find a newly created entries even when if it was fsynced
before.

Fix this by adjusting the ext4_add_entry() successful exit paths to set
the inode EXT4_STATE_NEWENTRY so that fsync has the chance to fsync the
parent directory as well.

Signed-off-by: Lukas Czerner &lt;lczerner@redhat.com&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Cc: Frank Mayhar &lt;fmayhar@google.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ext4: Replace open coded mdata csum feature to helper function</title>
<updated>2014-11-14T16:59:58Z</updated>
<author>
<name>Dmitry Monakhov</name>
</author>
<published>2014-10-13T07:36:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=366920c870923caa9e8bf1f1734545b3b3f74521'/>
<id>urn:sha1:366920c870923caa9e8bf1f1734545b3b3f74521</id>
<content type='text'>
commit 9aa5d32ba269bec0e7eaba2697a986a7b0bc8528 upstream.

Besides the fact that this replacement improves code readability
it also protects from errors caused direct EXT4_S(sb)-&gt;s_es manipulation
which may result attempt to use uninitialized  csum machinery.

#Testcase_BEGIN
IMG=/dev/ram0
MNT=/mnt
mkfs.ext4 $IMG
mount $IMG $MNT
#Enable feature directly on disk, on mounted fs
tune2fs -O metadata_csum  $IMG
# Provoke metadata update, likey result in OOPS
touch $MNT/test
umount $MNT
#Testcase_END

# Replacement script
@@
expression E;
@@
- EXT4_HAS_RO_COMPAT_FEATURE(E, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)
+ ext4_has_metadata_csum(E)

https://bugzilla.kernel.org/show_bug.cgi?id=82201

Signed-off-by: Dmitry Monakhov &lt;dmonakhov@openvz.org&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>ext4: add ext4_iget_normal() which is to be used for dir tree lookups</title>
<updated>2014-11-14T16:59:58Z</updated>
<author>
<name>Theodore Ts'o</name>
</author>
<published>2014-10-06T02:56:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1ae35c4429db5faebb217b4255077b196f14227e'/>
<id>urn:sha1:1ae35c4429db5faebb217b4255077b196f14227e</id>
<content type='text'>
commit f4bb2981024fc91b23b4d09a8817c415396dbabb upstream.

If there is a corrupted file system which has directory entries that
point at reserved, metadata inodes, prohibit them from being used by
treating them the same way we treat Boot Loader inodes --- that is,
mark them to be bad inodes.  This prohibits them from being opened,
deleted, or modified via chmod, chown, utimes, etc.

In particular, this prevents a corrupted file system which has a
directory entry which points at the journal inode from being deleted
and its blocks released, after which point Much Hilarity Ensues.

Reported-by: Sami Liedes &lt;sami.liedes@iki.fi&gt;
Signed-off-by: Theodore Ts'o &lt;tytso@mit.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4</title>
<updated>2014-01-28T16:54:16Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2014-01-28T16:54:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a53b75b37aacd85a2f005e80faf44a7c2e3aa0bc'/>
<id>urn:sha1:a53b75b37aacd85a2f005e80faf44a7c2e3aa0bc</id>
<content type='text'>
Pull ext4 update from Ted Ts'o:
 "Bug fixes and cleanups for ext4.  We also enable the punch hole
  functionality for bigalloc file systems"

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: delete "set but not used" variables
  ext4: don't pass freed handle to ext4_walk_page_buffers
  ext4: avoid clearing beyond i_blocks when truncating an inline data file
  ext4: ext4_inode_is_fast_symlink should use EXT4_CLUSTER_SIZE
  ext4: fix a typo in extents.c
  ext4: use %pd printk specificer
  ext4: standardize error handling in ext4_da_write_inline_data_begin()
  ext4: retry allocation when inline-&gt;extent conversion failed
  ext4: enable punch hole for bigalloc
</content>
</entry>
<entry>
<title>ext2/3/4: use generic posix ACL infrastructure</title>
<updated>2014-01-26T04:58:19Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2013-12-20T13:16:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=64e178a7118b1cf7648391755e44dcc209091003'/>
<id>urn:sha1:64e178a7118b1cf7648391755e44dcc209091003</id>
<content type='text'>
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ext4: use %pd printk specificer</title>
<updated>2014-01-06T19:04:23Z</updated>
<author>
<name>David Howells</name>
</author>
<published>2014-01-06T19:04:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a34e15cc35c743f0e49125a4fbd22a7c55b686d8'/>
<id>urn:sha1:a34e15cc35c743f0e49125a4fbd22a7c55b686d8</id>
<content type='text'>
Use the new %pd printk() specifier in Ext4 to replace passing of
dentry name or dentry name and name length * 2 with just passing the
dentry.

Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
cc: Andreas Dilger &lt;adilger.kernel@dilger.ca&gt;
cc: linux-ext4@vger.kernel.org
</content>
</entry>
<entry>
<title>ext[34]: fix double put in tmpfile</title>
<updated>2013-10-15T16:14:06Z</updated>
<author>
<name>Miklos Szeredi</name>
</author>
<published>2013-10-10T14:48:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=43ae9e3fc70ca0057ae0a24ef5eedff05e3fae06'/>
<id>urn:sha1:43ae9e3fc70ca0057ae0a24ef5eedff05e3fae06</id>
<content type='text'>
d_tmpfile() already swallowed the inode ref.

Signed-off-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>ext4: allocate delayed allocation blocks before rename</title>
<updated>2013-08-17T02:06:53Z</updated>
<author>
<name>Theodore Ts'o</name>
</author>
<published>2013-08-17T02:06:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e20270454e45ff54c9f8546159924038e31bfa0'/>
<id>urn:sha1:0e20270454e45ff54c9f8546159924038e31bfa0</id>
<content type='text'>
When ext4_rename() overwrites an already existing file, call
ext4_alloc_da_blocks() before starting the journal handle which
actually does the rename, instead of doing this afterwards.  This
improves the likelihood that the contents will survive a crash if an
application replaces a file using the sequence:

1)  write replacement contents to foo.new
2)  &lt;omit fsync of foo.new&gt;
3)  rename foo.new to foo

It is still not a guarantee, since ext4_alloc_da_blocks() is *not*
doing a file integrity sync; this means if foo.new is a very large
file, it may not be completely flushed out to disk.

However, for files smaller than a megabyte or so, any dirty pages
should be flushed out before we do the rename operation, and so at the
next journal commit, the CACHE FLUSH command will make sure al of
these pages are safely on the disk platter.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: start handle at least possible moment when renaming files</title>
<updated>2013-08-17T02:06:14Z</updated>
<author>
<name>Theodore Ts'o</name>
</author>
<published>2013-08-17T02:06:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5b61de757535095c99212c1ed857c3a0e0bbe386'/>
<id>urn:sha1:5b61de757535095c99212c1ed857c3a0e0bbe386</id>
<content type='text'>
In ext4_rename(), don't start the journal handle until the the
directory entries have been successfully looked up.

Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
</content>
</entry>
<entry>
<title>ext4: fix a BUG when opening a file with O_TMPFILE flag</title>
<updated>2013-07-21T01:58:38Z</updated>
<author>
<name>Zheng Liu</name>
</author>
<published>2013-07-21T01:58:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e94bd3490f4ef342801cfc76b33d8baf9ccc9437'/>
<id>urn:sha1:e94bd3490f4ef342801cfc76b33d8baf9ccc9437</id>
<content type='text'>
When we try to open a file with O_TMPFILE flag, we will trigger a bug.
The root cause is that in ext4_orphan_add() we check -&gt;i_nlink == 0 and
this check always fails because we set -&gt;i_nlink = 1 in
inode_init_always().  We can use the following program to trigger it:

int main(int argc, char *argv[])
{
	int fd;

	fd = open(argv[1], O_TMPFILE, 0666);
	if (fd &lt; 0) {
		perror("open ");
		return -1;
	}
	close(fd);
	return 0;
}

The oops message looks like this:

kernel BUG at fs/ext4/namei.c:2572!
invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
Modules linked in: dlci bridge stp hidp cmtp kernelcapi l2tp_ppp l2tp_netlink l2tp_core sctp libcrc32c rfcomm tun fuse nfnetli
nk can_raw ipt_ULOG can_bcm x25 scsi_transport_iscsi ipx p8023 p8022 appletalk phonet psnap vmw_vsock_vmci_transport af_key vmw_vmci rose vsock atm can netrom ax25 af_rxrpc ir
da pppoe pppox ppp_generic slhc bluetooth nfc rfkill rds caif_socket caif crc_ccitt af_802154 llc2 llc snd_hda_codec_realtek snd_hda_intel snd_hda_codec serio_raw snd_pcm pcsp
kr edac_core snd_page_alloc snd_timer snd soundcore r8169 mii sr_mod cdrom pata_atiixp radeon backlight drm_kms_helper ttm
CPU: 1 PID: 1812571 Comm: trinity-child2 Not tainted 3.11.0-rc1+ #12
Hardware name: Gigabyte Technology Co., Ltd. GA-MA78GM-S2H/GA-MA78GM-S2H, BIOS F12a 04/23/2010
task: ffff88007dfe69a0 ti: ffff88010f7b6000 task.ti: ffff88010f7b6000
RIP: 0010:[&lt;ffffffff8125ce69&gt;]  [&lt;ffffffff8125ce69&gt;] ext4_orphan_add+0x299/0x2b0
RSP: 0018:ffff88010f7b7cf8  EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffff8800966d3020 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff88007dfe70b8 RDI: 0000000000000001
RBP: ffff88010f7b7d40 R08: ffff880126a3c4e0 R09: ffff88010f7b7ca0
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801271fd668
R13: ffff8800966d2f78 R14: ffff88011d7089f0 R15: ffff88007dfe69a0
FS:  00007f70441a3740(0000) GS:ffff88012a800000(0000) knlGS:00000000f77c96c0
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000002834000 CR3: 0000000107964000 CR4: 00000000000007e0
DR0: 0000000000780000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000600
Stack:
 0000000000002000 00000020810b6dde 0000000000000000 ffff88011d46db00
 ffff8800966d3020 ffff88011d7089f0 ffff88009c7f4c10 ffff88010f7b7f2c
 ffff88007dfe69a0 ffff88010f7b7da8 ffffffff8125cfac ffff880100000004
Call Trace:
 [&lt;ffffffff8125cfac&gt;] ext4_tmpfile+0x12c/0x180
 [&lt;ffffffff811cba78&gt;] path_openat+0x238/0x700
 [&lt;ffffffff8100afc4&gt;] ? native_sched_clock+0x24/0x80
 [&lt;ffffffff811cc647&gt;] do_filp_open+0x47/0xa0
 [&lt;ffffffff811db73f&gt;] ? __alloc_fd+0xaf/0x200
 [&lt;ffffffff811ba2e4&gt;] do_sys_open+0x124/0x210
 [&lt;ffffffff81010725&gt;] ? syscall_trace_enter+0x25/0x290
 [&lt;ffffffff811ba3ee&gt;] SyS_open+0x1e/0x20
 [&lt;ffffffff816ca8d4&gt;] tracesys+0xdd/0xe2
 [&lt;ffffffff81001001&gt;] ? start_thread_common.constprop.6+0x1/0xa0
Code: 04 00 00 00 89 04 24 31 c0 e8 c4 77 04 00 e9 43 fe ff ff 66 25 00 d0 66 3d 00 80 0f 84 0e fe ff ff 83 7b 48 00 0f 84 04 fe ff ff &lt;0f&gt; 0b 49 8b 8c 24 50 07 00 00 e9 88 fe ff ff 0f 1f 84 00 00 00

Here we couldn't call clear_nlink() directly because in d_tmpfile() we
will call inode_dec_link_count() to decrease -&gt;i_nlink.  So this commit
tries to call d_tmpfile() before ext4_orphan_add() to fix this problem.

Reported-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: Zheng Liu &lt;wenqing.lz@taobao.com&gt;
Tested-by: Darrick J. Wong &lt;darrick.wong@oracle.com&gt;
Tested-by: Dave Jones &lt;davej@redhat.com&gt;
Signed-off-by: "Theodore Ts'o" &lt;tytso@mit.edu&gt;
Acked-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
</feed>
