Skip to content

Commit 878b6c1

Browse files
authored
Merge pull request #16 from OmSaran/posix_test
Changes to support using posix test suite on SplitFS
2 parents 1503a99 + 44bef6c commit 878b6c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+8376
-32
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
all:
2+
@echo Nothing here
3+
4+
test:
5+
@echo "============================ Executing Posix Mode ============================"
6+
$(MAKE) -C tests pjd.posix
7+
@echo "============================ Finished Posix Mode ============================="
8+
@echo "============================ Executing Sync Mode ============================="
9+
$(MAKE) -C tests pjd.sync
10+
@echo "============================ Finished Sync Mode =============================="
11+
@echo "============================ Executing Strict Mode ==========================="
12+
$(MAKE) -C tests pjd.strict
13+
@echo "============================ Finished Strict Mode ============================"
14+

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $ cd splitfs; make clean; make; cd .. # Compile SplitFS
2727
$ export LD_LIBRARY_PATH=./splitfs
2828
$ export NVP_TREE_FILE=./splitfs/bin/nvp_nvp.tree
2929
```
30-
4. <b>Set up ext4-DAX </b>
30+
4. #### Set up ext4-DAX
3131
```
3232
$ sudo mkfs.ext4 -b 4096 /dev/pmem0
3333
$ sudo mount -o dax /dev/pmem0 /mnt/pmem_emul
@@ -100,6 +100,31 @@ SplitFS is under active development.
100100
1. The current implementation of SplitFS handles the following system calls: `open, openat, close, read, pread64, write, pwrite64, fsync, unlink, ftruncate, fallocate, stat, fstat, lstat, dup, dup2, execve and clone`. The rest of the calls are passed through to the kernel.
101101
2. The current implementation of SplitFS works correctly for the following applictions: `LevelDB running YCSB, SQLite running TPCC, tar, git, rsync`. This limitation is purely due to the state of the implementation, and we aim to increase the coverage of applications by supporting more system calls in the future.
102102

103+
## Testing
104+
[PJD POSIX Test Suite](https://www.tuxera.com/community/posix-test-suite/) that tests primarily the metadata operations was run on SplitFS and yielded the following result.
105+
Tests Passed: 1944 out of a total of 1957.
106+
Tests that failed include:
107+
1. Tests on `link` (tests 56-58, 63-65 in links/00.t)
108+
2. Tests on `rename` (tests 49, 53, 57, 61 in rename/00.t)
109+
3. Tests on `unlink` (tests 17, 22, 53 in in unlink/00.t)
110+
111+
We aim to to improve this to a 100% pass rate soon.
112+
113+
**Running the Test Suite**
114+
Before running the tests, make sure you have [set-up ext4-DAX](#set-up-ext4-DAX)
115+
116+
To run tests in all modes:
117+
```
118+
$ make test
119+
```
120+
To run tests in a specific mode:
121+
```
122+
$ make -C tests pjd.<mode>
123+
```
124+
where `<mode>` is one of `posix`, `sync` or `strict`. Example: `make -C tests pjd.posix`
125+
126+
Tip: Redirect stderr for less verbose output: e.g `make test 2>/dev/null`
127+
103128
## License
104129

105130
Copyright for SplitFS is held by the University of Texas at Austin. Please contact us if you would like to obtain a license to use SplitFS in your commercial product.

splitfs/fileops_hub.c

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,6 @@ int hub_check_resolve_fileops(char* tree)
363363
{
364364
_hub_fd_lookup[i] = _hub_fileops;
365365
}
366-
_hub_fd_lookup[0] = _hub_managed_fileops;
367-
_hub_fd_lookup[1] = _hub_managed_fileops;
368-
_hub_fd_lookup[2] = _hub_managed_fileops;
369366

370367
return 0;
371368
}
@@ -815,6 +812,8 @@ RETT_OPENAT _hub_OPENAT(INTF_OPENAT)
815812
}
816813

817814
RETT_EXECVE _hub_EXECVE(INTF_EXECVE) {
815+
int pid = getpid();
816+
char exec_hub_filename[BUF_SIZE];
818817

819818
HUB_CHECK_RESOLVE_FILEOPS(_hub_, EXECVE);
820819

@@ -832,7 +831,8 @@ RETT_EXECVE _hub_EXECVE(INTF_EXECVE) {
832831
hub_ops[i] = 2;
833832
}
834833

835-
exec_hub_fd = shm_open("exec-hub", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
834+
sprintf(exec_hub_filename, "exec-hub-%d", pid);
835+
exec_hub_fd = shm_open(exec_hub_filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
836836
if (exec_hub_fd == -1) {
837837
printf("%s: %s\n", __func__, strerror(errno));
838838
assert(0);
@@ -864,6 +864,8 @@ RETT_EXECVE _hub_EXECVE(INTF_EXECVE) {
864864
}
865865

866866
RETT_EXECVP _hub_EXECVP(INTF_EXECVP) {
867+
int pid = getpid();
868+
char exec_hub_filename[BUF_SIZE];
867869

868870
HUB_CHECK_RESOLVE_FILEOPS(_hub_, EXECVP);
869871

@@ -881,13 +883,14 @@ RETT_EXECVP _hub_EXECVP(INTF_EXECVP) {
881883
hub_ops[i] = 2;
882884
}
883885

884-
exec_hub_fd = shm_open("exec-hub", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
886+
sprintf(exec_hub_filename, "exec-hub-%d", pid);
887+
exec_hub_fd = shm_open(exec_hub_filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
885888
if (exec_hub_fd == -1) {
886889
printf("%s: %s\n", __func__, strerror(errno));
887890
assert(0);
888891
}
889892

890-
int res = _hub_managed_fileops->FTRUNC64(exec_hub_fd, (1024*1024));
893+
int res = _hub_fileops->FTRUNC64(exec_hub_fd, (1024*1024));
891894
if (res == -1) {
892895
printf("%s: ftruncate failed. Err = %s\n", __func__, strerror(errno));
893896
assert(0);
@@ -918,8 +921,11 @@ RETT_SHM_COPY _hub_SHM_COPY() {
918921
int exec_hub_fd = -1, i = 0;
919922
int hub_ops[1024];
920923
unsigned long offset_in_map = 0;
924+
int pid = getpid();
925+
char exec_hub_filename[BUF_SIZE];
921926

922-
exec_hub_fd = shm_open("exec-hub", O_RDONLY, 0666);
927+
sprintf(exec_hub_filename, "exec-hub-%d", pid);
928+
exec_hub_fd = shm_open(exec_hub_filename, O_RDONLY, 0666);
923929
if (exec_hub_fd == -1) {
924930
MSG("%s: %s\n", __func__, strerror(errno));
925931
assert(0);
@@ -946,7 +952,7 @@ RETT_SHM_COPY _hub_SHM_COPY() {
946952
}
947953

948954
munmap(shm_area, 1024*1024);
949-
shm_unlink("exec-hub");
955+
shm_unlink(exec_hub_filename);
950956

951957
return _hub_managed_fileops->SHM_COPY();
952958
}
@@ -1101,16 +1107,18 @@ RETT_CLOSE _hub_CLOSE(INTF_CLOSE)
11011107
DEBUG("_hub_CLOSE is calling %s->CLOSE\n", _hub_fd_lookup[file]->name);
11021108

11031109
struct Fileops_p* temp = _hub_fd_lookup[file];
1104-
_hub_fd_lookup[file] = NULL;
1110+
1111+
// Restore it to the state similar to the initialised state.
1112+
_hub_fd_lookup[file] = _hub_fileops;
11051113
int result = temp->CLOSE(CALL_CLOSE);
11061114

11071115
if(result) {
11081116
DEBUG("call to %s->CLOSE failed: %s\n", _hub_fileops->name, strerror(errno));
1109-
return 0;
1117+
return result;
11101118
}
11111119

11121120
DEBUG_FILE("%s: Return = %d\n", __func__, result);
1113-
return 0;
1121+
return result;
11141122
}
11151123

11161124
#ifdef TRACE_FP_CALLS
@@ -1225,12 +1233,6 @@ RETT_DUP2 _hub_DUP2(INTF_DUP2)
12251233
else
12261234
{
12271235
DEBUG("DUP2 call completed successfully.\n");
1228-
1229-
if(result != fd2)
1230-
{
1231-
DEBUG("_hub_DUP2: result!=fd2 (%i != %i), so let's update the table...\n", result, fd2);
1232-
_hub_fd_lookup[fd2] = NULL;
1233-
}
12341236

12351237
DEBUG("Hub(dup2) managing new FD %i with same ops (\"%s\") as initial FD (%i)\n",
12361238
result, _hub_fd_lookup[file]->name, file);
@@ -1479,3 +1481,4 @@ RETT_CLONE _hub_CLONE(INTF_CLONE)
14791481
*/
14801482

14811483
// breaking the build
1484+

splitfs/fileops_nvp.c

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,11 @@ void _nvp_SHM_COPY() {
10211021
int exec_ledger_fd = -1;
10221022
int i,j;
10231023
unsigned long offset_in_map = 0;
1024-
1025-
exec_ledger_fd = shm_open("exec-ledger", O_RDONLY, 0666);
1024+
int pid = getpid();
1025+
char exec_nvp_filename[BUF_SIZE];
1026+
1027+
sprintf(exec_nvp_filename, "exec-ledger-%d", pid);
1028+
exec_ledger_fd = shm_open(exec_nvp_filename, O_RDONLY, 0666);
10261029

10271030
if (exec_ledger_fd == -1) {
10281031
printf("%s: shm_open failed. Err = %s\n", __func__, strerror(errno));
@@ -1096,7 +1099,7 @@ void _nvp_SHM_COPY() {
10961099
}
10971100

10981101
munmap(shm_area, 10*1024*1024);
1099-
shm_unlink("exec-ledger");
1102+
shm_unlink(exec_nvp_filename);
11001103
}
11011104

11021105
void _mm_cache_flush(void const* p) {
@@ -1244,13 +1247,11 @@ void _nvp_init2(void)
12441247
if (!_nvp_node_lookup[i])
12451248
assert(0);
12461249

1247-
#if WORKLOAD_TAR | WORKLOAD_GIT | WORKLOAD_RSYNC
12481250
_nvp_backup_roots[i] = (struct backupRoots*)calloc(OPEN_MAX,
12491251
sizeof(struct backupRoots));
12501252
if (!_nvp_backup_roots[i])
12511253
assert(0);
12521254

1253-
#endif // WORKLOAD_TAR
12541255

12551256
memset((void *)_nvp_node_lookup[i], 0, OPEN_MAX * sizeof(struct NVNode));
12561257
// Allocating and initializing all the dynamic structs inside struct NVNode
@@ -1276,11 +1277,9 @@ void _nvp_init2(void)
12761277
// Allocating and Initializing DR root of the node
12771278
memset((void *)&_nvp_node_lookup[i][j].dr_info, 0, sizeof(struct free_dr_pool));
12781279

1279-
#if WORKLOAD_TAR | WORKLOAD_GIT | WORKLOAD_RSYNC
12801280
_nvp_backup_roots[i][j].root = _nvp_node_lookup[i][j].root;
12811281
_nvp_backup_roots[i][j].merkle_root = _nvp_node_lookup[i][j].merkle_root;
12821282
_nvp_backup_roots[i][j].root_dirty_cache = _nvp_node_lookup[i][j].root_dirty_cache;
1283-
#endif // WORKLOAD_TAR
12841283

12851284
}
12861285
}
@@ -1555,15 +1554,15 @@ void _nvp_init2(void)
15551554
*/
15561555
atexit(nvp_exit_handler);
15571556

1558-
#if WORKLOAD_TAR | WORKLOAD_GIT | WORKLOAD_RSYNC
1557+
int pid = getpid();
1558+
char exec_nvp_filename[BUF_SIZE];
15591559

1560-
if (access("/dev/shm/exec-ledger", F_OK ) != -1)
1560+
sprintf(exec_nvp_filename, "/dev/shm/exec-ledger-%d", pid);
1561+
if (access(exec_nvp_filename, F_OK ) != -1)
15611562
execv_done = 1;
15621563
else
15631564
execv_done = 0;
15641565

1565-
#endif // WORKLOAD_TAR
1566-
15671566
}
15681567

15691568
void nvp_transfer_to_free_dr_pool(struct NVNode *node)
@@ -4744,6 +4743,8 @@ RETT_EXECVE _nvp_EXECVE(INTF_EXECVE) {
47444743

47454744
int exec_ledger_fd = -1, i = 0;
47464745
unsigned long offset_in_map = 0;
4746+
int pid = getpid();
4747+
char exec_nvp_filename[BUF_SIZE];
47474748

47484749
for (i = 0; i < 1024; i++) {
47494750
if (_nvp_fd_lookup[i].offset != NULL)
@@ -4752,7 +4753,8 @@ RETT_EXECVE _nvp_EXECVE(INTF_EXECVE) {
47524753
execve_fd_passing[i] = 0;
47534754
}
47544755

4755-
exec_ledger_fd = shm_open("exec-ledger", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
4756+
sprintf(exec_nvp_filename, "exec-ledger-%d", pid);
4757+
exec_ledger_fd = shm_open(exec_nvp_filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
47564758
if (exec_ledger_fd == -1) {
47574759
printf("%s: %s\n", __func__, strerror(errno));
47584760
assert(0);
@@ -4813,6 +4815,8 @@ RETT_EXECVP _nvp_EXECVP(INTF_EXECVP) {
48134815

48144816
int exec_ledger_fd = -1, i = 0;
48154817
unsigned long offset_in_map = 0;
4818+
int pid = getpid();
4819+
char exec_nvp_filename[BUF_SIZE];
48164820

48174821
for (i = 0; i < 1024; i++) {
48184822
if (_nvp_fd_lookup[i].offset != NULL)
@@ -4825,8 +4829,9 @@ RETT_EXECVP _nvp_EXECVP(INTF_EXECVP) {
48254829
if (_nvp_fd_lookup[i].node != NULL && _nvp_fd_lookup[i].valid)
48264830
_nvp_FSYNC(_nvp_fd_lookup[i].fd);
48274831
}
4828-
4829-
exec_ledger_fd = shm_open("exec-ledger", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
4832+
4833+
sprintf(exec_nvp_filename, "exec-ledger-%d", pid);
4834+
exec_ledger_fd = shm_open(exec_nvp_filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
48304835
if (exec_ledger_fd == -1) {
48314836
printf("%s: %s\n", __func__, strerror(errno));
48324837
assert(0);
@@ -5911,6 +5916,9 @@ RETT_DUP2 _nvp_DUP2(INTF_DUP2)
59115916
nvf2->node = nvf->node;
59125917
nvf2->valid = nvf->valid;
59135918
nvf2->posix = nvf->posix;
5919+
// Increment the refernce count as this file
5920+
// descriptor is pointing to the same NVFNode
5921+
nvf2->node->reference++;
59145922

59155923
SANITYCHECK(nvf2->node != NULL);
59165924
SANITYCHECK(nvf2->valid);
@@ -6541,3 +6549,4 @@ RETT_FALLOCATE _nvp_FALLOCATE(INTF_FALLOCATE)
65416549
return result;
65426550
}
65436551
*/
6552+

splitfs/nv_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "boost/preprocessor/seq/for_each.hpp"
3333
//#include "boost/preprocessor/cat.hpp"
3434

35+
#define BUF_SIZE 40
36+
3537
#define MIN(X,Y) (((X)<(Y))?(X):(Y))
3638
#define MAX(X,Y) (((X)>(Y))?(X):(Y))
3739

tests/Makefile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Run tests for splitfs
2+
3+
# The current working directory
4+
CWD=$(shell pwd)
5+
# Root of the repo
6+
ROOT=$(CWD)/..
7+
# SplitFS path
8+
SFS_PATH=/mnt/pmem_emul/
9+
# PJD Dir
10+
PJD_DIR=$(CWD)/pjd-fstest-20080816
11+
12+
all: pjd.posix pjd.sync pjd.strict
13+
14+
# Compile with posix specific flags
15+
pjd.posix_compile:
16+
export LEDGER_DATAJ=0 && \
17+
export LEDGER_POSIX=1 && \
18+
$(MAKE) -C ../splitfs clean && \
19+
$(MAKE) -e -C ../splitfs
20+
21+
# Compile with sync specific flags
22+
pjd.sync_compile:
23+
export LEDGER_DATAJ=0 && \
24+
export LEDGER_POSIX=0 && \
25+
$(MAKE) -C ../splitfs clean && \
26+
$(MAKE) -e -C ../splitfs
27+
28+
# Compile with strict specific flags
29+
pjd.strict_compile:
30+
export LEDGER_DATAJ=1 && \
31+
export LEDGER_POSIX=0 && \
32+
$(MAKE) -C ../splitfs clean && \
33+
$(MAKE) -e -C ../splitfs
34+
35+
pjd.compile:
36+
$(MAKE) -C $(PJD_DIR) clean
37+
$(MAKE) -C $(PJD_DIR)
38+
39+
pjd.run:
40+
export LD_LIBRARY_PATH=$(ROOT)/splitfs; \
41+
export NVP_TREE_FILE=$(ROOT)/splitfs/bin/nvp_nvp.tree; \
42+
export LD_PRELOAD=$(ROOT)/splitfs/libnvp.so; \
43+
cd $(SFS_PATH) && prove -r $(PJD_DIR)/tests
44+
45+
pjd.posix: pjd.posix_compile pjd.compile pjd.run
46+
47+
pjd.sync: pjd.sync_compile pjd.compile pjd.run
48+
49+
pjd.strict: pjd.strict_compile pjd.compile pjd.run

tests/pjd-fstest-20080816/LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
$FreeBSD: src/tools/regression/fstest/LICENSE,v 1.1 2007/01/17 01:42:07 pjd Exp $
2+
3+
License for all regression tests available with fstest:
4+
5+
Copyright (c) 2006-2007 Pawel Jakub Dawidek <[email protected]>
6+
All rights reserved.
7+
8+
Redistribution and use in source and binary forms, with or without
9+
modification, are permitted provided that the following conditions
10+
are met:
11+
1. Redistributions of source code must retain the above copyright
12+
notice, this list of conditions and the following disclaimer.
13+
2. Redistributions in binary form must reproduce the above copyright
14+
notice, this list of conditions and the following disclaimer in the
15+
documentation and/or other materials provided with the distribution.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
21+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27+
SUCH DAMAGE.

tests/pjd-fstest-20080816/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# $FreeBSD: src/tools/regression/fstest/Makefile,v 1.1 2007/01/17 01:42:07 pjd Exp $
2+
3+
#CFLAGS+=-DHAS_LCHMOD
4+
#CFLAGS+=-DHAS_CHFLAGS
5+
#CFLAGS+=-DHAS_LCHFLAGS
6+
#CFLAGS+=-DHAS_TRUNCATE64
7+
#CFLAGS+=-DHAS_STAT64
8+
9+
all: fstest
10+
11+
fstest: fstest.c
12+
gcc -Wall ${CFLAGS} fstest.c -o fstest
13+
14+
clean:
15+
rm -f fstest

0 commit comments

Comments
 (0)