Add trace! logging for server-side getattr
continuous-integration/drone the build was successful Details

This commit is contained in:
Olivier 'reivilibre' 2022-02-07 21:29:17 +00:00
parent 7fbe51db68
commit 300baef5c5
2 changed files with 7 additions and 4 deletions

View File

@ -7,7 +7,8 @@ edition = "2021"
[dependencies] [dependencies]
## Robustness ## Robustness
log = "0.4.14" # Disable trace! in release mode.
log = { version = "0.4.14", features = ["release_max_level_debug"] }
env_logger = "0.9.0" env_logger = "0.9.0"
anyhow = "1.0.52" anyhow = "1.0.52"
bare-metrics-recorder = "0.1.0" bare-metrics-recorder = "0.1.0"

View File

@ -14,7 +14,7 @@ use std::{io, mem};
use anyhow::{anyhow, bail}; use anyhow::{anyhow, bail};
use libc::{ELOOP, O_NOFOLLOW}; use libc::{ELOOP, O_NOFOLLOW};
use log::{error, warn}; use log::{error, trace, warn};
use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::os::unix::fs::{MetadataExt, PermissionsExt};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::Arc; use std::sync::Arc;
@ -257,9 +257,11 @@ impl FileAccess {
pub async fn getattr(&self, vnode: VnodeId) -> anyhow::Result<DataResponse<FileMetadata>> { pub async fn getattr(&self, vnode: VnodeId) -> anyhow::Result<DataResponse<FileMetadata>> {
let inode_map = self.client_state.inode_map.read().await; let inode_map = self.client_state.inode_map.read().await;
if let Some(inode_info) = inode_map.get(vnode.0 as usize) { if let Some(inode_info) = inode_map.get(vnode.0 as usize) {
Ok(self let result = self
.read_metadata(&inode_info.real_path, vnode) .read_metadata(&inode_info.real_path, vnode)
.await .await;
trace!("getattr. Inode {:?} Path: {:?} = {:?}", vnode.0, inode_info.real_path, result);
Ok(result
.map_or_else( .map_or_else(
|err| io_error_to_response(err, ENOENT, "getattr"), |err| io_error_to_response(err, ENOENT, "getattr"),
|fm| DataResponse::Success(fm), |fm| DataResponse::Success(fm),