commit - ab9934da3316cf362e131acdcb2b3171ac7fbf5e
commit + 33aa3497b959ad985e7fb0f016da798f30f2eef0
blob - 2aa1ff329a9854a3546308a2478d50ba2765ef88
blob + 50db83dc79e5f1e7414070beb4d8af7607a5aeeb
--- README.md
+++ README.md
(similar to [libeatmydata](https://github.com/stewartsmith/libeatmydata),
but applicable to any file operation).
- `errinj_slowdown` - slowdown invoked file operation.
+- `errinj_1byte_read` - amount of data returned by `read()` call is always
+ limited by a single byte.
### Building
blob - 30eeca1c904bafffd986784e482ba7cc4e28e3e3
blob + 217c01a4511b1b701ccc4797cc33df4cd314bbe8
--- unreliablefs-scm-1.rockspec
+++ unreliablefs-scm-1.rockspec
- `errinj_kill_caller` - send SIGKILL to a process that invoked file operation;
- `errinj_noop` - replace file operation with no operation;
- `errinj_slowdown` - slowdown invoked file operation;
+ - `errinj_1byte_read` - amount of data returned by `read()` call is always
+ limited by a single byte.
]],
homepage = "https://github.com/ligurio/unreliablefs",
maintainer = "Sergey Bronnikov <estetus@gmail.com>",
blob - 624bc25cbc29c1d549c4793cb4762e4fffb54cb9
blob + 80dcc3cbdabbe540e7a9508a1c46da01b70bc22f
--- unreliablefs.conf.5
+++ unreliablefs.conf.5
limited by supported errno's.
.It Cm errinj_slowdown
File operation slowdown for nanoseconds specified by duration parameter.
+.It Cm errinj_1byte_read
+Return exactly 1 byte on every
+.Xr read 2
+operation.
.El
.Pp
The options are:
path_regexp = *.xlog
probability = 4
+[errinj_1byte_read]
+path_regexp = *.xlog
+probability = 100
+
.Ed
.Sh SEE ALSO
.Xr unreliablefs 1 ,
blob - a069f4d30b8733e56219169b4b1fdef1463ff865
blob + 681de370bee5409a2d894725dac3f3e8b7c19dc2
--- unreliablefs_errinj.c
+++ unreliablefs_errinj.c
"errinj_kill_caller",
"errinj_noop",
"errinj_slowdown",
+ "errinj_1byte_read",
};
typedef enum {
ERRINJ_KILL_CALLER,
ERRINJ_NOOP,
ERRINJ_SLOWDOWN,
+ ERRINJ_1BYTE_READ,
} errinj_type;
typedef struct errinj_conf errinj_conf;
fprintf(stdout, "end of '%s' slowdown with '%d' ns\n", op_name, err->duration);
}
break;
+ case ERRINJ_1BYTE_READ:
+ fprintf(stdout, "start of 1-byte read\n");
+ if (strcmp(op_name, "read") == 0)
+ rc = -ERRINJ_1BYTE_READ;
+ break;
}
}
blob - 299d5027cf13cf486938e683038b60e40fb351c7
blob + 4889de8d7338eb0cba5c6cfb742dce4469fb4e09
--- unreliablefs_errinj.h
+++ unreliablefs_errinj.h
#define MIN_PROBABLITY 0
#define MAX_PROBABLITY 100
#define ERRNO_NOOP -999
+#define ERRNO_1BYTE_READ -998
#define DEFAULT_SIGNAL_NAME SIGKILL
int error_inject(const char* path, fuse_op operation);
blob - f9d48d5620657020de0adbd34b01a2a66fc90241
blob + 2c20d7d3e8f7c14556e8854760919a4e48ef5551
--- unreliablefs_ops.c
+++ unreliablefs_ops.c
int ret = error_inject(path, OP_READ);
if (ret == -ERRNO_NOOP) {
return 0;
+ } else if (ret == -ERRNO_1BYTE_READ) {
+ size = 1;
} else if (ret) {
return ret;
}