vfs: fix ancestry check in rename()

Renaming to destination which is a substring of the source path
but not its parent should succeed:

  rename("/tmp/one_two", "/tmp/one") == 0

Renaming to a child should fail:

  rename("/tmp/", "/tmp/child") == -1 && errno = EINVAL

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
vfs: namei() should return ENOTDIR when component is not a directory

The call to namei("/dir/file/") currently fails with ENOENT when
"/dir/file" exists. A more standard way is to return ENOTDIR
instead. This way calls to stat, open, rename, etc. will be in
line with the POSIX spec.

It is also useful to rename() implementation which needs to
differentiate behaviour between the case in which target does not
exist and the case in which it does but the path has trailing slash
and the last component is not a directory.

In addition to that the check was performed in an inconsistent matter
- only when dentry lookup failed. This change makes the check
performed always.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
vfs: fix incorrect rename() behavior with trailing slashes

Fix 1. Renaming existing directory to existing file when the
destination path has trailing slash should fail:

  rename("/tmp/dir", "/tmp/file/") == -1 && errno == ENOTDIR

Fix 2. Renaming exisitng directory to nonexisting path when the path
has trailing slash should succeed:

  rename("/tmp/dir", "/tmp/im_missing/") == 0

Fix 3. Renaming exisitng file to nonexisting path when the path
has trailing slash should fail:

  rename("/tmp/file", "/tmp/im_missing/") == -1 && errno == ENOTDIR

Reference:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html

This change also adds a bunch of test cases for various conditions
mentioned in the spec. Note that for some cases where the raname()
should fail there are discrepancies between Linux and OSv in error
codes set by the call. To my understanding, the spec is ambiguous.
There are conditions which match more than one error code
description. The tests are therefore allowing the call to set error
code from a set of matching error codes (eg. both EEXIST and ENOTEMPTY
are allowed when applicable). If we decide that OSv should return
exactly the same error codes as Linux for the same conditions, this
can be changed later.

vfs: rename() should fail if paths differ only with trailing slash

This should fail:

  rename("/tmp/file", "/tmp/file/")

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
vfs: rename() should fail if either path ends with . or ..

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
vfs: make rename() return ENOENT when one of the paths is empty

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Extend the test whitelist

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
runjava: Add missing delegation to OSv system classloader

When system classloader is used as a parent some of its protected
methods are called to lookup resources.

This also adds delegation for all remaining protected and public
methods.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>