Stop using SO_SNDBUFFORCE
Use SO_SNDBUF which doesn't require CAP_NET_ADMIN instead. Change the value of kFuseMaxWrite to 128KB. In the kernel code, there is a constant FUSE_MAX_PAGES_PER_REQ which limits the size of requests to 128KB. Bug: 74725300 Test: atest android.os.storage.cts.StorageManagerTest Change-Id: Ic3a8f1a7378d027a6c0ee054cedc2c9f4b7509ad
This commit is contained in:
parent
84379567d3
commit
3d95d88b14
2 changed files with 3 additions and 3 deletions
|
@ -149,8 +149,8 @@ bool SetupMessageSockets(base::unique_fd (*result)[2]) {
|
|||
}
|
||||
|
||||
constexpr int kMaxMessageSize = sizeof(FuseBuffer);
|
||||
if (setsockopt(fds[0], SOL_SOCKET, SO_SNDBUFFORCE, &kMaxMessageSize, sizeof(int)) != 0 ||
|
||||
setsockopt(fds[1], SOL_SOCKET, SO_SNDBUFFORCE, &kMaxMessageSize, sizeof(int)) != 0) {
|
||||
if (setsockopt(fds[0], SOL_SOCKET, SO_SNDBUF, &kMaxMessageSize, sizeof(int)) != 0 ||
|
||||
setsockopt(fds[1], SOL_SOCKET, SO_SNDBUF, &kMaxMessageSize, sizeof(int)) != 0) {
|
||||
PLOG(ERROR) << "Failed to update buffer size for socket";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace fuse {
|
|||
|
||||
// The numbers came from sdcard.c.
|
||||
// Maximum number of bytes to write/read in one request/one reply.
|
||||
constexpr size_t kFuseMaxWrite = 256 * 1024;
|
||||
constexpr size_t kFuseMaxWrite = 128 * 1024;
|
||||
constexpr size_t kFuseMaxRead = 128 * 1024;
|
||||
constexpr int32_t kFuseSuccess = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue