Re: [PATCH 10/11] samples: Add fs error monitoring example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gabriel,

I love your patch! Yet something to improve:

[auto build test ERROR on ext3/fsnotify]
[also build test ERROR on linus/master v5.13-rc2 next-20210521]
[cannot apply to ext4/dev]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Gabriel-Krisman-Bertazi/File-system-wide-monitoring/20210522-235132
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git fsnotify
config: um-allmodconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/a68dabe209f26c50d700b7be44603351f95221cd
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Gabriel-Krisman-Bertazi/File-system-wide-monitoring/20210522-235132
        git checkout a68dabe209f26c50d700b7be44603351f95221cd
        # save the attached .config to linux build tree
        make W=1 ARCH=um 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

>> samples/fanotify/fs-monitor.c:23:36: error: field 'hdr' has incomplete type
      23 |  struct fanotify_event_info_header hdr;
         |                                    ^~~
   samples/fanotify/fs-monitor.c: In function 'handle_notifications':
>> samples/fanotify/fs-monitor.c:55:26: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 2 has type '__kernel_fsid_t' {aka 'struct <anonymous>'} [-Wformat=]
      55 |   printf("      fsid: %llx\n", error->fsid);
         |                       ~~~^     ~~~~~~~~~~~
         |                          |          |
         |                          |          __kernel_fsid_t {aka struct <anonymous>}
         |                          long long unsigned int
   samples/fanotify/fs-monitor.c: In function 'main':
>> samples/fanotify/fs-monitor.c:76:37: error: 'FAN_MARK_FILESYSTEM' undeclared (first use in this function); did you mean 'FAN_MARK_FLUSH'?
      76 |  if (fanotify_mark(fd, FAN_MARK_ADD|FAN_MARK_FILESYSTEM,
         |                                     ^~~~~~~~~~~~~~~~~~~
         |                                     FAN_MARK_FLUSH
   samples/fanotify/fs-monitor.c:76:37: note: each undeclared identifier is reported only once for each function it appears in


vim +/hdr +23 samples/fanotify/fs-monitor.c

    21	
    22	struct fanotify_event_info_error {
  > 23		struct fanotify_event_info_header hdr;
    24		int error;
    25		__kernel_fsid_t fsid;
    26		unsigned long inode;
    27		__u32 error_count;
    28	};
    29	#endif
    30	
    31	static void handle_notifications(char *buffer, int len)
    32	{
    33		struct fanotify_event_metadata *metadata;
    34		struct fanotify_event_info_error *error;
    35	
    36		for (metadata = (struct fanotify_event_metadata *) buffer;
    37		     FAN_EVENT_OK(metadata, len); metadata = FAN_EVENT_NEXT(metadata, len)) {
    38			if (!(metadata->mask == FAN_ERROR)) {
    39				printf("unexpected FAN MARK: %llx\n", metadata->mask);
    40				continue;
    41			} else if (metadata->fd != FAN_NOFD) {
    42				printf("Unexpected fd (!= FAN_NOFD)\n");
    43				continue;
    44			}
    45	
    46			printf("FAN_ERROR found len=%d\n", metadata->event_len);
    47	
    48			error = (struct fanotify_event_info_error *) (metadata+1);
    49			if (error->hdr.info_type == FAN_EVENT_INFO_TYPE_ERROR) {
    50				printf("unknown record: %d\n", error->hdr.info_type);
    51				continue;
    52			}
    53	
    54			printf("  Generic Error Record: len=%d\n", error->hdr.len);
  > 55			printf("      fsid: %llx\n", error->fsid);
    56			printf("      error: %d\n", error->error);
    57			printf("      inode: %lu\n", error->inode);
    58			printf("      error_count: %d\n", error->error_count);
    59		}
    60	}
    61	
    62	int main(int argc, char **argv)
    63	{
    64		int fd;
    65		char buffer[BUFSIZ];
    66	
    67		if (argc < 2) {
    68			printf("Missing path argument\n");
    69			return 1;
    70		}
    71	
    72		fd = fanotify_init(FAN_CLASS_NOTIF, O_RDONLY);
    73		if (fd < 0)
    74			errx(1, "fanotify_init");
    75	
  > 76		if (fanotify_mark(fd, FAN_MARK_ADD|FAN_MARK_FILESYSTEM,

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux