lib: add SAFE_RENAME()

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
syscalls/getcwd04.c: regression test for getcwd(2)

Note: this test has already been in xfstests generic/028 test case,
I just port it to LTP. And this bug is hard or impossible to reprodeced
in a single cpu machine.

Kernel commit '232d2d60aa5469bb097f55728f65146bd49c1d25' introduced a race
condition that causes getcwd(2) to return "/" instead of correct path.
    232d2d6 dcache: Translating dentry into pathname without
            taking rename_lock

And these two kernel commits have fixed this bug:
  ede4cebce16f5643c61aedd6d88d9070a1d23a68
     prepend_path() needs to reinitialize dentry/vfsmount/mnt on restarts
  f6500801522c61782d4990fa1ad96154cb397cd4
     f650080 __dentry_path() fixes

This test is to check whether this bug exists in the running kernel,
or whether this bug has been fixed.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>