vfs: fix rename on non-empty directories

If you opened, let's say /dir1/file1, and renamed
/dir1 (a non-empty directory) to /dir2, it would
still be possible to find the file file1 at the
path /dir1/file1 as its entry in dentry hashtable
wasn't invalidated.

This patch fixes that problem by keeping a list of
child dentries in each dentry, and when a non-empty
directory is renamed, all of its active children
should be invalidated from the dentry hashtable.
Per-dentry lock was added to deal with concurrency.
Testcase was added into tst-rename.cc to assert that
the problem is indeed gone.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
vfs: better rcu file deletion

Instead of rcu-disposing the memory in a file object, rcu-dispose the object
itself.  This prevents issues with accessing a destroyed (but not freed)
object.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
pthread: remove magic number for limit of pthread tsd keys

Use PTHREAD_KEYS_MAX (value is 128) instead.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Zifei Tong <zifeitong@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
epoll: improve tracepoints

Since we keep the fd, we may as well emit it in tracepoints as it is more
useful than the file pointer.  Also provide the event information.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
epoll: fix deadlock in socket_file::epoll_add()

The normal lock order is the socket lock, then file::f_lock, but
socket_file::epoll_add() inverts that order.

Fix by moving things around to use the expected order.

Fixes wrk running in osv (as a client).

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Avi Kivity <avi@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
release-ec2: do not rely on hard-coded template AMI ID

Find suitable AMI intead

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
aarch64: implement cpuid features_str API

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Revert "build.mk pass arch to the module compilation"

This reverts commit 7ec82f862a594136a1b4de800f4e5a44dc038076.

Glauber Costa writes:

  make image=redis-memonly now fails to build.

  the failure is:

  MAKE hiredis
  cd hiredis && make static
  make[6]: Entering directory `/home/glauber/osv-clean/apps/redis-memonly/upstream/redis-3.0.0-beta3/deps/hiredis'
  cc -std=c99 -pedantic -c -O3 -fPIC -fPIC -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb x64 net.c
  cc: error: x64: No such file or directory

  Looking at the history, it seems that it was introduced by
  7ec82f862a594136a1b4de800f4e5a44dc038076, and indeed, reverting it restores
  the build to normal.

Conflicts:
	build.mk