Skip to content

Commit

Permalink
gateway: Add error handlings for leo-project#611
Browse files Browse the repository at this point in the history
  • Loading branch information
mocchira committed Mar 3, 2017
1 parent cbc8f82 commit ba45f55
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions apps/leo_gateway/src/leo_nfs_proto3_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,22 @@ nfsproc3_rmdir_3({{{UID}, Name}} = _1, Clnt, State) ->
case is_empty_dir(Path4S3Dir) of
true ->
Key = filename:join(Path4S3Dir, ?NFS_DUMMY_FILE4S3DIR_OLD),
catch leo_gateway_rpc_handler:delete(Key),
Key_2 = filename:join(Path4S3Dir, ?NFS_DUMMY_FILE4S3DIR),
catch leo_gateway_rpc_handler:delete(Key_2),
{reply, {?NFS3_OK, {?SIMPLENFS_WCC_EMPTY}}, State};
case leo_gateway_rpc_handler:delete(Key) of
ok ->
Key_2 = filename:join(Path4S3Dir, ?NFS_DUMMY_FILE4S3DIR),
case leo_gateway_rpc_handler:delete(Key_2) of
ok ->
{reply, {?NFS3_OK, {?SIMPLENFS_WCC_EMPTY}}, State};
{error, Reason} ->
?error("nfsproc3_rmdir_3/3",
[{path, Key_2}, {cause, Reason}]),
{reply, {?NFS3ERR_IO, {?SIMPLENFS_WCC_EMPTY}}, State}
end;
{error, Reason} ->
?error("nfsproc3_rmdir_3/3",
[{path, Key}, {cause, Reason}]),
{reply, {?NFS3ERR_IO, {?SIMPLENFS_WCC_EMPTY}}, State}
end;
false ->
{reply, {?NFS3ERR_NOTEMPTY, {?SIMPLENFS_WCC_EMPTY}}, State}
end.
Expand Down

0 comments on commit ba45f55

Please sign in to comment.