From 300baef5c51be731b8c12258bf3716ae060060d7 Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Mon, 7 Feb 2022 21:29:17 +0000 Subject: [PATCH] Add trace! logging for server-side getattr --- olivefsd/Cargo.toml | 3 ++- olivefsd/src/server/file_access.rs | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/olivefsd/Cargo.toml b/olivefsd/Cargo.toml index 668877e..ddfccf1 100644 --- a/olivefsd/Cargo.toml +++ b/olivefsd/Cargo.toml @@ -7,7 +7,8 @@ edition = "2021" [dependencies] ## 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" anyhow = "1.0.52" bare-metrics-recorder = "0.1.0" diff --git a/olivefsd/src/server/file_access.rs b/olivefsd/src/server/file_access.rs index 619cdb1..c2928ed 100644 --- a/olivefsd/src/server/file_access.rs +++ b/olivefsd/src/server/file_access.rs @@ -14,7 +14,7 @@ use std::{io, mem}; use anyhow::{anyhow, bail}; use libc::{ELOOP, O_NOFOLLOW}; -use log::{error, warn}; +use log::{error, trace, warn}; use std::os::unix::fs::{MetadataExt, PermissionsExt}; use std::path::{Path, PathBuf}; use std::sync::Arc; @@ -257,9 +257,11 @@ impl FileAccess { pub async fn getattr(&self, vnode: VnodeId) -> anyhow::Result> { let inode_map = self.client_state.inode_map.read().await; if let Some(inode_info) = inode_map.get(vnode.0 as usize) { - Ok(self + let result = self .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( |err| io_error_to_response(err, ENOENT, "getattr"), |fm| DataResponse::Success(fm),