Skip to contentSkip to conversation

Bug: "could not open backing-store directory: /usr/lib/tgt/backing-store" message at startup

DISCUSSION Applied Lee Duncan 2 participants 4 messages Nov 13, 2015 – Nov 19, 2015 Kbuild

lore
Share & tools
lore

Lee Duncan

author
#0 lore raw

Hello:

I have found a small problem recently when tgtd is configured for no back-end support modules.

The Makefile in usr has these lines:

Quoted 8 lines

install: $(PROGRAMS) $(MODULES)

	install -d -m 755 $(DESTDIR)$(sbindir)
	install -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir)
ifneq ($(MODULES),)
	install -d -m 755 $(DESTDIR)$(libdir)/backing-store
	install -m 755 $(MODULES) $(DESTDIR)$(libdir)/backing-store

endif

So if no modules are defined, that the backing-store directory will never get created. Which makes sense I suppose -- it will never be needed, since it is only used for modules.

But then the code in usr/bs.c seems to consider it an error when the directory does not exist:

Quoted 11 lines

static int bs_init_signalfd(void)

{
	sigset_t mask;
	int ret;
	DIR *dir;

	dir = opendir(BSDIR);
	if (dir == NULL) {
		eprintf("could not open backing-store module directory %s\n",
			BSDIR);
	} else {
Quoted 2 lines

...
}

causing an error message each time tgtd starts, and this shows up on the systemd status output, which is not good.

This seems like more of an informational message in this case, since the bs_init_signalfd() function does not return a failure code in this case.

It seems like the "right" way to fix it would be change this code to not consider this case an error -- perhaps just a debugging message?

Another simple solution would be to change the Makefile so that the backing-store directory always gets created, and only the installation of MODULES becomes conditional on having MODULES.

I can supply a patch for either case. Which would you prefer?

Signature · 1 line
Lee Duncan
#1 lore raw

Hi,

Quoted 2 lines · On Fri, 13 Nov 2015 20:36:47 +0100 Lee Duncan <[email protected]> wrote:

It seems like the "right" way to fix it would be change this code to not consider this case an error -- perhaps just a debugging message?

Sounds reasonable to me. Can you send a patch?

Thanks,

author
#2 lore raw

backing-store modules directory not present is not an error

The backing-store modules directory, normally /usr/lib/tgt/backing-store, is not created, needed, or used when there are no backing store modules. So change the error message printed when the directory is not present to a debug message.

---

usr/bs.c +2 -1
diff -aurp tgt-1.0.44.orig/usr/bs.c tgt-1.0.44/usr/bs.c
@@ -267,7 +267,8 @@ static int bs_init_signalfd(void)
 
 	dir = opendir(BSDIR);
 	if (dir == NULL) {
-		eprintf("could not open backing-store module directory %s\n",
+		/* not considered an error if there are no modules */
+		dprintf("could not open backing-store module directory %s\n",
 			BSDIR);
 	} else {
 		struct dirent *dirent;
#3 lore raw

Re: backing-store modules directory not present is not an error

Quoted 6 lines · On Sun, 15 Nov 2015 17:15:51 -0800 Lee Duncan <[email protected]> wrote:

The backing-store modules directory, normally /usr/lib/tgt/backing-store, is not created, needed, or used when there are no backing store modules. So change the error message printed when the directory is not present to a debug message.

Applied, thanks.